gh-f stable release 1.0.0
I have worked on gh-f for about one year and I have now reached the point where I consider it to be stable and robust enough to award it a full 1.0.0 release.
## What is it?
## Is it better or worse than the others?
There are many git-fzf projects out there and they are all very good: so why should you install this other one? Because it's all-in-one place, compact, with one line installation (as
## What about this latest release?
This 1.0.0 contains no major features or improvement. Only I took the time to go through most bugfixes with many intermediate releases, often incorporating previous feedback received here on reddit/discord/GitHub and having my friends and coworkers use it for long enough to unearth major errors.
Have a look: link to the repository - there are demos, gifs and full documentation with examples. Feel free to comment, open issues and provide suggestions.
https://redd.it/x8a32w
@r_bash
I have worked on gh-f for about one year and I have now reached the point where I consider it to be stable and robust enough to award it a full 1.0.0 release.
## What is it?
gh-f is a gh CLI extension that dreams to be the ultimate fzf git integration. There are many git-fzf projects out there and we all have our own shell functions to do this and that: I wanted to unify most of it and create a one-stop shop that might address the vast majority of daily usage of git and GitHub: whilst of course it may not fulfill all needs, I found myself fulfilling most of my git needs through it.## Is it better or worse than the others?
There are many git-fzf projects out there and they are all very good: so why should you install this other one? Because it's all-in-one place, compact, with one line installation (as
gh extension) and with no need to set-up (and remember) new aliases or learn to move around some complicated TUI. It really is just git and fzf, but hopefully complete enough to replace 90% of your daily git commands. Moreover, it is easily extensible as it is just bash code that you can fork and make your own, if you want it to behave differently (no need to learn anything new if you want to make a change)## What about this latest release?
This 1.0.0 contains no major features or improvement. Only I took the time to go through most bugfixes with many intermediate releases, often incorporating previous feedback received here on reddit/discord/GitHub and having my friends and coworkers use it for long enough to unearth major errors.
Have a look: link to the repository - there are demos, gifs and full documentation with examples. Feel free to comment, open issues and provide suggestions.
https://redd.it/x8a32w
@r_bash
GitHub
GitHub - gennaro-tedesco/gh-f: 🔎 the ultimate compact fzf gh extension
🔎 the ultimate compact fzf gh extension. Contribute to gennaro-tedesco/gh-f development by creating an account on GitHub.
set -x is your friend
I enjoy looking through all the posts in this sub, to see the weird shit you guys are trying to do. Also, I think most people are happy to help, if only to flex their knowledge. However, a huge part of programming in general is learning how to troubleshoot something, not just having someone else fix it for you. One of the basic ways to do that in bash is `set -x`. Not only can this help you figure out what your noscript is doing and how it's doing it, but in the event that you need help from another person, posting the output can be beneficial to the person attempting to help.
Also, writing noscripts in an IDE that supports Bash. syntax highlighting can immediately tell you that you're doing something wrong.
If an IDE isn't an option, https://www.shellcheck.net/
https://redd.it/xcejrb
@r_bash
I enjoy looking through all the posts in this sub, to see the weird shit you guys are trying to do. Also, I think most people are happy to help, if only to flex their knowledge. However, a huge part of programming in general is learning how to troubleshoot something, not just having someone else fix it for you. One of the basic ways to do that in bash is `set -x`. Not only can this help you figure out what your noscript is doing and how it's doing it, but in the event that you need help from another person, posting the output can be beneficial to the person attempting to help.
Also, writing noscripts in an IDE that supports Bash. syntax highlighting can immediately tell you that you're doing something wrong.
If an IDE isn't an option, https://www.shellcheck.net/
https://redd.it/xcejrb
@r_bash
Linuxhint
Bash `set -x` command – Linux Hint
This tutorial is on multiple ways of enabling debugging feature for the bash noscript and the uses of the `set -x` command for debugging the bash noscript.
Having issues with editing strings
Hello, i am very new to bash noscripting and i want to remove a part of a string and save into a variable to later use in the noscript
i have a noscript that goes like this
fullString="file/filename/fizz/buzz"
cutString=${fullString} | cut -d/ -f3-
echo ${cutString}
i want to output fizz/buzz only, but i dont get anything at all
https://redd.it/xcdybx
@r_bash
Hello, i am very new to bash noscripting and i want to remove a part of a string and save into a variable to later use in the noscript
i have a noscript that goes like this
fullString="file/filename/fizz/buzz"
cutString=${fullString} | cut -d/ -f3-
echo ${cutString}
i want to output fizz/buzz only, but i dont get anything at all
https://redd.it/xcdybx
@r_bash
reddit
Having issues with editing strings
Hello, i am very new to bash noscripting and i want to remove a part of a string and save into a variable to later use in the noscript i have a...
Imagemagick annotate noscript, almost but not quite...
What I want to do..
> convert dragon.gif \
> -gravity North -background YellowGreen -splice 0x18 \
> -annotate +0+2 'Faerie Dragon' anno_splice2.gif
What I have...
>\#!/bin/bash
>echo
>echo -n "Image to use: "
>read -e infile
>echo
>echo -n "Enter text: "
>read -e text
>echo
>convert $infile -gravity North -background black -fill green -pointsize 28 -splice 0x35 -annotate +0+2 $text out.gif
Works fine with one word text but I want to enter multi word text.
Tried single and double quoting when running noscript. Nope.
Tried entering word\nword just to see what would happen, though I don't want two lines. Nope.
Tried quoting '$text' and backslashing the quotes. Nope.
*halp*
https://redd.it/xcjbie
@r_bash
What I want to do..
> convert dragon.gif \
> -gravity North -background YellowGreen -splice 0x18 \
> -annotate +0+2 'Faerie Dragon' anno_splice2.gif
What I have...
>\#!/bin/bash
>echo
>echo -n "Image to use: "
>read -e infile
>echo
>echo -n "Enter text: "
>read -e text
>echo
>convert $infile -gravity North -background black -fill green -pointsize 28 -splice 0x35 -annotate +0+2 $text out.gif
Works fine with one word text but I want to enter multi word text.
Tried single and double quoting when running noscript. Nope.
Tried entering word\nword just to see what would happen, though I don't want two lines. Nope.
Tried quoting '$text' and backslashing the quotes. Nope.
*halp*
https://redd.it/xcjbie
@r_bash
reddit
Imagemagick annotate noscript, almost but not quite...
What I want to do.. > convert dragon.gif \ > -gravity North -background YellowGreen -splice 0x18 \ > -annotate +0+2 'Faerie Dragon' ...
Can someone tell me what this command does "%00{.exec|ping -c 127.0.0.1"
https://redd.it/xckcfb
@r_bash
https://redd.it/xckcfb
@r_bash
reddit
Can someone tell me what this command does "%00{.exec|ping -c...
Posted in r/bash by u/Silent_Philosophy_86 • 1 point and 1 comment
Relative path Script and file in the same directory, trying to ma
I've got a file called 1.txt as well as a noscript in the same directory. Now, I'd like to run the noscript in order to copy 1.txt to another directory. However, I'd like to do that using a relative path.
I've tried:
... but to no avail as I'm getting the following error:
https://redd.it/x87lne
@r_bash
I've got a file called 1.txt as well as a noscript in the same directory. Now, I'd like to run the noscript in order to copy 1.txt to another directory. However, I'd like to do that using a relative path.
I've tried:
cp ./1.txt /whatever/folder ... but to no avail as I'm getting the following error:
cp: can't stat './1.txt' : No such file or directory.https://redd.it/x87lne
@r_bash
reddit
Relative path Script and file in the same directory, trying to ma
I've got a file called 1.txt as well as a noscript in the **same** directory. Now, I'd like to run the noscript in order to copy 1.txt to another...
use sed for add a txt file in another
Hello, i can't understand how to do this command.
​
I have an output file, and input file.
the output file is already write.
i need in this output file to add a new line in the top of the file, with the record inside input file.
​
i try multiple times but i can't understand how.
https://redd.it/x83ypl
@r_bash
Hello, i can't understand how to do this command.
​
I have an output file, and input file.
the output file is already write.
i need in this output file to add a new line in the top of the file, with the record inside input file.
​
i try multiple times but i can't understand how.
https://redd.it/x83ypl
@r_bash
reddit
use sed for add a txt file in another
Hello, i can't understand how to do this command. I have an output file, and input file. the output file is already write. i need in...
Changing environment variable after running a certain command.
In my bashrc I currently have this line:
export PROMPTCOMMAND="export PROMPTCOMMAND=echo"
What this does is, it will print a new line after every command EXCEPT the first one. it helps with readability and my terminal does not have an awkward space on the first line, it would look like this:
Prompt-$: Sample command
Command output
Prompt-$:
This is the expected behaviour. However, after clearing my terminal, the environment variable for PROMPT_COMMAND will still be "echo", so it will leave a gap over the prompt:
(After running clear)
(reddit won't let me add blank lines, but this line is blank in my terminal haha)
Prompt-$: Sample command
Command output
Prompt-$:
I have tried to fix it by creating a custom noscript that exports PROMPT_COMMAND to "export PROMPT_COMMAND=echo" and then runs clear. But again that is no good. Is there any way I can change it when I run ls?
https://redd.it/xcqa68
@r_bash
In my bashrc I currently have this line:
export PROMPTCOMMAND="export PROMPTCOMMAND=echo"
What this does is, it will print a new line after every command EXCEPT the first one. it helps with readability and my terminal does not have an awkward space on the first line, it would look like this:
Prompt-$: Sample command
Command output
Prompt-$:
This is the expected behaviour. However, after clearing my terminal, the environment variable for PROMPT_COMMAND will still be "echo", so it will leave a gap over the prompt:
(After running clear)
(reddit won't let me add blank lines, but this line is blank in my terminal haha)
Prompt-$: Sample command
Command output
Prompt-$:
I have tried to fix it by creating a custom noscript that exports PROMPT_COMMAND to "export PROMPT_COMMAND=echo" and then runs clear. But again that is no good. Is there any way I can change it when I run ls?
https://redd.it/xcqa68
@r_bash
reddit
Changing environment variable after running a certain command.
In my bashrc I currently have this line: export PROMPT_COMMAND="export PROMPT_COMMAND=echo" What this does is, it will print a new line...
A minimalistic bash prompt
I wrote a small bash prompt. This is based off common prompt for zsh. Let me know your thoughts.
Baksho
https://redd.it/x84wut
@r_bash
I wrote a small bash prompt. This is based off common prompt for zsh. Let me know your thoughts.
Baksho
https://redd.it/x84wut
@r_bash
GitHub
GitHub - abhi-g80/baksho: Minimalistic prompt theme for Bash
Minimalistic prompt theme for Bash. Contribute to abhi-g80/baksho development by creating an account on GitHub.
is There a way to run a Function in a subshell so it won't leave the current directory?
SOLUTION
GOAL:
1. Go to ANIMES folder
2. Use the noscript
3. All of this in a sub-shell so you're won't leave the current directory
OBS: Change "Piece.02" for whatever anime/episode I want.
CODE (provided by spizzike in the comments):
vf() (
cd /folder/you/want
find . -name "$1" -and '(' -iname '.mp4' -or -iname '.mkv' -or -iname '.avi' ')' -exec vlc '{}' +
)
1. The noscript search for the word I provided
2. Check if it's a video file (.mp4 or mkv or avi)
3. And launch it in VLC
All of this without leaving the directory you're in.
.
.
.
ORIGINAL POST
Hi bash ninjas!
Question 1 - How to run a function in a sub-shell.
My goal is to launch an episode from an anime from any place, using the find command and providing the number of the episode I want to watch, all of this in a sub-shell.
So, I basically want a function to:
1 - Open a specific directory
2 - Search a file inside the directory based on a number I'll provide.
3 - Get the file found and launch it on VLC.
4 - Do all this in a sub-shell so I will remain in whatever directory I'm in before use the function/noscript.
I came up with this:
vf() {
(var=$(find /directory/I/want -wholename "$1" -and -wholename ".mkv")
vlc "$var")
}
The function works but I end up in the directory I provided to find; the (), that runs aliases in a sub-shell doesn't seem to work in functions.
Question 2 - How to search for many different file formats at once?
I'm searching for .mkv files, but if I want the function to work with other video formats, like .mp4 or .avi, how would I do that?
https://redd.it/x7qmw1
@r_bash
SOLUTION
GOAL:
1. Go to ANIMES folder
2. Use the noscript
vf Piece.02 to search the episode two of One Piece and launch it on VLC.3. All of this in a sub-shell so you're won't leave the current directory
OBS: Change "Piece.02" for whatever anime/episode I want.
CODE (provided by spizzike in the comments):
vf() (
cd /folder/you/want
find . -name "$1" -and '(' -iname '.mp4' -or -iname '.mkv' -or -iname '.avi' ')' -exec vlc '{}' +
)
1. The noscript search for the word I provided
2. Check if it's a video file (.mp4 or mkv or avi)
3. And launch it in VLC
All of this without leaving the directory you're in.
.
.
.
ORIGINAL POST
Hi bash ninjas!
Question 1 - How to run a function in a sub-shell.
My goal is to launch an episode from an anime from any place, using the find command and providing the number of the episode I want to watch, all of this in a sub-shell.
So, I basically want a function to:
1 - Open a specific directory
2 - Search a file inside the directory based on a number I'll provide.
3 - Get the file found and launch it on VLC.
4 - Do all this in a sub-shell so I will remain in whatever directory I'm in before use the function/noscript.
I came up with this:
vf() {
(var=$(find /directory/I/want -wholename "$1" -and -wholename ".mkv")
vlc "$var")
}
The function works but I end up in the directory I provided to find; the (), that runs aliases in a sub-shell doesn't seem to work in functions.
Question 2 - How to search for many different file formats at once?
I'm searching for .mkv files, but if I want the function to work with other video formats, like .mp4 or .avi, how would I do that?
https://redd.it/x7qmw1
@r_bash
reddit
is There a way to run a Function in a subshell so it won't leave...
**SOLUTION** **GOAL**: 1. Go to ANIMES folder 2. Use the noscript `vf Piece.02` to search the episode two of One Piece and launch it on VLC. 3....
My first bash noscript. Automates youtube playlist videos. This is an invitation to creatively improve it :) feel free to add anything, through github. Also follow the resulting channel or my github if you'd like.
https://github.com/MarcoCasanova00/bashytube
https://redd.it/xcv6jx
@r_bash
https://github.com/MarcoCasanova00/bashytube
https://redd.it/xcv6jx
@r_bash
GitHub
GitHub - MarcoCasanova00/bashytube: Downloads an mp3 file from a youtube video you specify, then makes a video with that mp3 and…
Downloads an mp3 file from a youtube video you specify, then makes a video with that mp3 and a random image from a folder. - GitHub - MarcoCasanova00/bashytube: Downloads an mp3 file from a youtube...
How to avoid duplications using sed
I am trying to append some lines using sed and if I run the sed twice it will duplicate the lines. How to avoid this like if I mistakenly run same sed command it should not duplicate.
https://redd.it/x7tcyu
@r_bash
I am trying to append some lines using sed and if I run the sed twice it will duplicate the lines. How to avoid this like if I mistakenly run same sed command it should not duplicate.
https://redd.it/x7tcyu
@r_bash
reddit
How to avoid duplications using sed
I am trying to append some lines using sed and if I run the sed twice it will duplicate the lines. How to avoid this like if I mistakenly run same...
Remove a function when vim or any other program opens
So, I have a function in my bashrc which displays the time in my terminal, however I don't want the function to run when vim or some other program is opened is this possible?
https://redd.it/x7xkpy
@r_bash
So, I have a function in my bashrc which displays the time in my terminal, however I don't want the function to run when vim or some other program is opened is this possible?
https://redd.it/x7xkpy
@r_bash
reddit
Remove a function when vim or any other program opens
So, I have a function in my bashrc which displays the time in my terminal, however I don't want the function to run when vim or some other program...
wild card works in shell but not in noscript
So I'm writing a noscript for my church and I'm trying to use a wild card to copy some files from one directory to another. It's noteworthy to mention that it's on a flash drive. So when I run the command the the terminal it works just fine, but when I run it as a noscript it doesn't work. Here's an example, and I'll post the actual noscript if that would be helpful
Cp /run/media/username/church/noscript\ resources/ hymnal/hymns/tlh"$hymn1"*.mid /run/media/username/church/"$datefolder"
I should note that the wild card is to fill in the unknown parts of the file name, things like \_5 for 5 verses
Also both of the variables are defined already
I will probably be posting the noscript because I realize that will be helpful
Here is the noscript:
#!/bin/bash
user=$(pwd | cut -d / -f 4)
distro=$(distro | grep Fedora)
if [ $? != 0 ]
then
distro=/media/
else
distro=/run/media/
fi
fdrive="$distro$user/church"
hymnpath="$fdrive/Script\ resources/hymns/Lutheran\ hymnal/"
hymn_1=$1
hymn_2=$2
hymn_3=$3
hymn_4=$4
date=$5
date_folder="$fdrive/$date"
litpath="$fdrive/Script\ resources/Litergies/"
if [ "$1" == "-n" ]
then
read -p "Enter the first hymn " hymn_1
read -p "Enter the second hymn " hymn_2
read -p "Enter the third hymn " hymn_3
read -p "Enter the fourth hymn " hymn_4
read -p "Enter the date " date
fi
if [ "$1" == "-h" ]
then
echo "Syntax:"
echo "./hymnnoscript [hymn 1] [hymn 2] [hymn 3] [hymn 4] [date]"
echo "enter n for no parameters"
echo "enter h for help"
fi
regular (){
echo "regular"
cp "$hymnpath"tlh"$hymn_1"*.mid $date_folder
cp "$litpath"revisedPAGE5best*.mid $date_folder
cp "$hymnpath"tlh"$hymn_2"*.mid $date_folder
cp "$litpath"OFFERPG5*.mid $date_folder
cp "$hymnpath"tlh"$hymn_3"*.mid $date_folder
cp "$litpath"2collectbendpg14*.mid $date_folder
cp "$hymnpath"tlh"$hymn_4"*.mid $date_folder
}
mkdir $date_folder
ls /run/media/user-0/church/Script\ resources/*/
regular
Here is the error:
cp: cannot stat '/run/media/user-0/church/Script\ resources/hymns/Lutheran\ hymnal/tlh123*.mid': No such file or directory
cp: cannot stat '/run/media/user-0/church/Script\ resources/Litergies/revisedPAGE5best*.mid': No such file or directory
cp: cannot stat '/run/media/user-0/church/Script\ resources/hymns/Lutheran\ hymnal/tlh125*.mid': No such file or directory
cp: cannot stat '/run/media/user-0/church/Script\ resources/Litergies/OFFERPG5*.mid': No such file or directory
cp: cannot stat '/run/media/user-0/church/Script\ resources/hymns/Lutheran\ hymnal/tlh124*.mid': No such file or directory
cp: cannot stat '/run/media/user-0/church/Script\ resources/Litergies/2collectbendpg14*.mid': No such file or directory
cp: cannot stat '/run/media/user-0/church/Script\ resources/hymns/Lutheran\ hymnal/tlh127*.mid': No such file or directory
​
https://redd.it/x7t7f8
@r_bash
So I'm writing a noscript for my church and I'm trying to use a wild card to copy some files from one directory to another. It's noteworthy to mention that it's on a flash drive. So when I run the command the the terminal it works just fine, but when I run it as a noscript it doesn't work. Here's an example, and I'll post the actual noscript if that would be helpful
Cp /run/media/username/church/noscript\ resources/ hymnal/hymns/tlh"$hymn1"*.mid /run/media/username/church/"$datefolder"
I should note that the wild card is to fill in the unknown parts of the file name, things like \_5 for 5 verses
Also both of the variables are defined already
I will probably be posting the noscript because I realize that will be helpful
Here is the noscript:
#!/bin/bash
user=$(pwd | cut -d / -f 4)
distro=$(distro | grep Fedora)
if [ $? != 0 ]
then
distro=/media/
else
distro=/run/media/
fi
fdrive="$distro$user/church"
hymnpath="$fdrive/Script\ resources/hymns/Lutheran\ hymnal/"
hymn_1=$1
hymn_2=$2
hymn_3=$3
hymn_4=$4
date=$5
date_folder="$fdrive/$date"
litpath="$fdrive/Script\ resources/Litergies/"
if [ "$1" == "-n" ]
then
read -p "Enter the first hymn " hymn_1
read -p "Enter the second hymn " hymn_2
read -p "Enter the third hymn " hymn_3
read -p "Enter the fourth hymn " hymn_4
read -p "Enter the date " date
fi
if [ "$1" == "-h" ]
then
echo "Syntax:"
echo "./hymnnoscript [hymn 1] [hymn 2] [hymn 3] [hymn 4] [date]"
echo "enter n for no parameters"
echo "enter h for help"
fi
regular (){
echo "regular"
cp "$hymnpath"tlh"$hymn_1"*.mid $date_folder
cp "$litpath"revisedPAGE5best*.mid $date_folder
cp "$hymnpath"tlh"$hymn_2"*.mid $date_folder
cp "$litpath"OFFERPG5*.mid $date_folder
cp "$hymnpath"tlh"$hymn_3"*.mid $date_folder
cp "$litpath"2collectbendpg14*.mid $date_folder
cp "$hymnpath"tlh"$hymn_4"*.mid $date_folder
}
mkdir $date_folder
ls /run/media/user-0/church/Script\ resources/*/
regular
Here is the error:
cp: cannot stat '/run/media/user-0/church/Script\ resources/hymns/Lutheran\ hymnal/tlh123*.mid': No such file or directory
cp: cannot stat '/run/media/user-0/church/Script\ resources/Litergies/revisedPAGE5best*.mid': No such file or directory
cp: cannot stat '/run/media/user-0/church/Script\ resources/hymns/Lutheran\ hymnal/tlh125*.mid': No such file or directory
cp: cannot stat '/run/media/user-0/church/Script\ resources/Litergies/OFFERPG5*.mid': No such file or directory
cp: cannot stat '/run/media/user-0/church/Script\ resources/hymns/Lutheran\ hymnal/tlh124*.mid': No such file or directory
cp: cannot stat '/run/media/user-0/church/Script\ resources/Litergies/2collectbendpg14*.mid': No such file or directory
cp: cannot stat '/run/media/user-0/church/Script\ resources/hymns/Lutheran\ hymnal/tlh127*.mid': No such file or directory
​
https://redd.it/x7t7f8
@r_bash
reddit
wild card works in shell but not in noscript
So I'm writing a noscript for my church and I'm trying to use a wild card to copy some files from one directory to another. It's noteworthy to...
If I can use bash on Windows, why bother using Linux at all?
I know this might be a noob question for you people, however, I think there are few other noob people like me wondering about this :)
I have been using Linux for 3 months now for work (we use an application that only works on Linux). My boss has taught me some Linux tricks and he is a long-time Linux user. All the things he showed me are just Bash commands.
It seemed like it was all about the command window and how powerful Linux is because of that only.
Then I asked, "Wait for a second, it turns out I can use bash on Windows too, then why Linux?"
Is it bash that makes Linux powerful, or something else?
https://redd.it/x89c1l
@r_bash
I know this might be a noob question for you people, however, I think there are few other noob people like me wondering about this :)
I have been using Linux for 3 months now for work (we use an application that only works on Linux). My boss has taught me some Linux tricks and he is a long-time Linux user. All the things he showed me are just Bash commands.
It seemed like it was all about the command window and how powerful Linux is because of that only.
Then I asked, "Wait for a second, it turns out I can use bash on Windows too, then why Linux?"
Is it bash that makes Linux powerful, or something else?
https://redd.it/x89c1l
@r_bash
reddit
If I can use bash on Windows, why bother using Linux at all?
I know this might be a noob question for you people, however, I think there are few other noob people like me wondering about this :) I have been...
Is This Geocode Script Broken?
Hi, I have an address string, ex: "2240 Saint Claude Avenue, New Orleans, LA 70117"
And have been searching for a noscript to convert this type of input into a pair of longitude and latitude coordinates. A noscript I found on [Webgears](https://www.webgears.com/blog/simple-noscript-to-get-latitude-and-longitude-from-an-address/) seems perfect/practical for that purpose and appears as follows
#!/bin/sh
url='http://www.mapquestapi.com/geocoding/v1/address?key='
args='&location='
key='YourMapQuestAPIKey'
converter="$url$key$args"
addr="$(echo $* | sed 's/ /+/g')" curl -s "$converter$addr" | \
cut -d\" -f117,119 | \
sed 's/[^0-9\.\,\-]//g;s/,$//' exit 0
Except it doesn't seem to work at all. Apparently searching for files etc instead of performing any function. The author says input should appear as such:
>./geocode.sh 8865 SE Bridge Road, Hobe Sound, FL
Does anyone have an idea of why this might be? I've tried to execute this on both Win10 and Ubuntu.
https://redd.it/x7ohgn
@r_bash
Hi, I have an address string, ex: "2240 Saint Claude Avenue, New Orleans, LA 70117"
And have been searching for a noscript to convert this type of input into a pair of longitude and latitude coordinates. A noscript I found on [Webgears](https://www.webgears.com/blog/simple-noscript-to-get-latitude-and-longitude-from-an-address/) seems perfect/practical for that purpose and appears as follows
#!/bin/sh
url='http://www.mapquestapi.com/geocoding/v1/address?key='
args='&location='
key='YourMapQuestAPIKey'
converter="$url$key$args"
addr="$(echo $* | sed 's/ /+/g')" curl -s "$converter$addr" | \
cut -d\" -f117,119 | \
sed 's/[^0-9\.\,\-]//g;s/,$//' exit 0
Except it doesn't seem to work at all. Apparently searching for files etc instead of performing any function. The author says input should appear as such:
>./geocode.sh 8865 SE Bridge Road, Hobe Sound, FL
Does anyone have an idea of why this might be? I've tried to execute this on both Win10 and Ubuntu.
https://redd.it/x7ohgn
@r_bash
Webgears
Simple Script to get Latitude and Longitude from an address
A Simple Script to get the Latitude and Longitude (forward Geocode values) from an address using the MapQuest API
Having Issues Comparing Strings
In part of my noscript I am trying to check if the string variable is equal to an uppercase B, but the check doesn't seem to return true with the variable is B. Does any part of this code look incorrect?
i = 0
if [ $f0 == `B` ];
then
((i++))
fi
Prior to the code snippet above, my code gets f0 by finding a file path and removing the all parts of the path and file extension except for the name - which is B (i.e. path/to/file/B.png gets turned into B)
https://redd.it/xd7a3p
@r_bash
In part of my noscript I am trying to check if the string variable is equal to an uppercase B, but the check doesn't seem to return true with the variable is B. Does any part of this code look incorrect?
i = 0
if [ $f0 == `B` ];
then
((i++))
fi
Prior to the code snippet above, my code gets f0 by finding a file path and removing the all parts of the path and file extension except for the name - which is B (i.e. path/to/file/B.png gets turned into B)
https://redd.it/xd7a3p
@r_bash
reddit
Having Issues Comparing Strings
In part of my noscript I am trying to check if the string variable is equal to an uppercase B, but the check doesn't seem to return true with the...
Download root-owned files via scp or rsync as a sudo user
How to download the file which requires
Note that this sudo-user is not configured to not require the password for
And
And download command may look like this
This command gives a "permission denied" error as
In order to download this file, sudo-user should be switched to root
So is there a way in
https://redd.it/xd7nml
@r_bash
How to download the file which requires
root permission from a remote server (via scp or rsync) as a sudo-user (non-interactive way)?Note that this sudo-user is not configured to not require the password for
sudo commands.And
sshpass is installed on both local and remote systems.And download command may look like this
sshpass -p {sudo-user-pass} scp {sudo-user}@{host}:/path/to/some/root/owned/file.tar.gz ./
This command gives a "permission denied" error as
file.tar.gz is owned by the root.In order to download this file, sudo-user should be switched to root
sudo -suSo is there a way in
scp or rsync where sudo-user can switch to root and download the root-owned files (non-interactively)?https://redd.it/xd7nml
@r_bash
reddit
Download root-owned files via scp or rsync as a sudo user
How to download the file which requires `root` permission from a remote server (via `scp` or `rsync`) as a sudo-user (non-interactive...
How to get raw output of network list?
i making a bash noscript to control my wifi via dmenu and i use this command to get list of available networks:
iwctl station wlan0 get-networks
i am really new in bash, so i'd like to chop-chop the table i get using this command)
i don't know where to start, i don't really understand tools like cut/grep/awk( pls help
i want to output to be just list of names of this networks
​
sample:
Available networks
--------------------------------------------------------------------------------
Network name Security Signal
--------------------------------------------------------------------------------
> lll psk
eee psk
aaa psk
sample output
lll
eee
aaa
​
https://redd.it/xd9enh
@r_bash
i making a bash noscript to control my wifi via dmenu and i use this command to get list of available networks:
iwctl station wlan0 get-networks
i am really new in bash, so i'd like to chop-chop the table i get using this command)
i don't know where to start, i don't really understand tools like cut/grep/awk( pls help
i want to output to be just list of names of this networks
​
sample:
Available networks
--------------------------------------------------------------------------------
Network name Security Signal
--------------------------------------------------------------------------------
> lll psk
eee psk
aaa psk
sample output
lll
eee
aaa
​
https://redd.it/xd9enh
@r_bash
reddit
How to get raw output of network list?
i making a bash noscript to control my wifi via dmenu and i use this command to get list of available networks: iwctl station wlan0...
Run commands in same Time
So I have multiple command that I want to run it in the same time what is best options ?
https://redd.it/xd760p
@r_bash
So I have multiple command that I want to run it in the same time what is best options ?
https://redd.it/xd760p
@r_bash
Help me figure out the right way to format this curl command? ("@" in URL password)
Edit: Solved using curl -u admin:p@ssword -H "Range: depth=1" -H "Accept: application/json" --digest "http://10.0.0.1/restapi/"
​
I'm pulling my hair out on this one and everything I find says to just put the URL in quotes and it'll be good. It is not good.
​
>curl -H "Range: depth=1" -H "Accept: application/json" \\
>
>\--digest "http://admin:p@ssword@10.0.0.1/restapi/"
The "@" in "p@ssword" is causing this command to be interpreted as the hostname of the base URL being "ssword@10.0.0.1", which is clearly not the intent. I cannot, for the life of me, figure out how to escape this character.
Thanks
https://redd.it/x7pd11
@r_bash
Edit: Solved using curl -u admin:p@ssword -H "Range: depth=1" -H "Accept: application/json" --digest "http://10.0.0.1/restapi/"
​
I'm pulling my hair out on this one and everything I find says to just put the URL in quotes and it'll be good. It is not good.
​
>curl -H "Range: depth=1" -H "Accept: application/json" \\
>
>\--digest "http://admin:p@ssword@10.0.0.1/restapi/"
The "@" in "p@ssword" is causing this command to be interpreted as the hostname of the base URL being "ssword@10.0.0.1", which is clearly not the intent. I cannot, for the life of me, figure out how to escape this character.
Thanks
https://redd.it/x7pd11
@r_bash
reddit
Help me figure out the right way to format this curl command? ("@"...
Edit: Solved using curl -u admin:p@ssword -H "Range: depth=1" -H "Accept: application/json" --digest "http://10.0.0.1/restapi/" I'm...