I want to do something like this.
$ touch a\ b
$ cmd=cat\ a\ b
$ echo $cmd
cat a b
cat: a: No such file or directory
cat: b: No such file or directory
There are problems with the spaces in the ...
I can run this from the command line and it works: find /var/www/vhosts/foo/httpdocs/content/templates/ -name '*.plg' -print | xargs sed -i 's|mysql_|mysqli_|g'
So I wrote the following sed.sh file ...
It is often said that variables should be double quoted when used.
In the following example I want to have the command echo "You can't see me" in a variable and run it in such a way that the output ...
I have this part of shell script :
shopt -s extglob
I want to add "debug" optio to my script, for that I added a read commands in specific places in the code. Basically it look like this:
READ_USER_INPUT_IF_IN_DEBUG_MODE="read -p 'press any ...
I have a list of commands in a file called cmds, one command per line.
I want to grab the last command, set it in a variable last_command and run it later. with $last_command or "$last_command", or ...
I'm trying to call a command from a variable in a script with a specific locale, example :
$ myYTDL="LANG=C.UTF-8 youtube-dl --get-filename"
but each time I try and call it in the script, I get :
Or, an introductory guide to robust filename handling and other string passing in shell scripts.
I wrote a shell script which works well most of the time. But it chokes on some inputs (e.g. on some ...
If you've been following unix.stackexchange.com for a while, you
should hopefully know by now that leaving a variable
unquoted in list context (as in echo $var) in Bourne/POSIX
shells (zsh being the ...
In a Bash script, I'm trying to store the options I'm using for rsync in a separate variable. This works fine for simple options (like --recursive), but I'm running into problems with --exclude='.*':