escaping - Command to escape a string in bash - Stack Overflow
http://stackoverflow.com/questions/2854655/command-to-escape-a-string-in-bash- http://stackoverflow.com/questions/2854655/command-to-escape-a-string-in-bash
- http://stackoverflow.com/questions/6306386/how-can-i-escape-an-arbitrary-string-for-use-as-a-command-line-argument-in-bash
- http://stackoverflow.com/questions/8467424/echo-new-line-in-bash-prints-literal-n
Especially when printing or creating strings using user arguments to a bash script, special characters or even spaces may be introduced. We don't want a string argument to be split up into several arguments, so those values need to be escaped.
$ printf "%q" "hello\world" hello\\world
linux - eval command in Bash and its typical uses - Stack Overflow
http://stackoverflow.com/questions/11065077/eval-command-in-bash-and-its-typical-usesThere is a way of saying 'the value of the variable whose name is in this variable'
echo ${!n} one
Always put double quotes around variable and command substitutions, unless you know you need to leave them off. - Gilles
http://stackoverflow.com/questions/11065077/eval-command-in-bash-and-its-typical-uses
newline - Echo new line in bash prints literal \n - Stack Overflow
http://stackoverflow.com/questions/8467424/echo-new-line-in-bash-prints-literal-nWhen desiring to display the name of the script file being run, even when the extra '.' is included out front...
$ ./s $0 is: ./s $BASH_SOURCE is: ./s $ . ./s $0 is: bash $BASH_SOURCE is: ./s
Why should eval be avoided in bash, and what should I use instead? - Stack Overflow
http://stackoverflow.com/questions/17529220/why-should-eval-be-avoided-in-bash-and-what-should-i-use-insteadUsing eval
does smell dangerous. This might be a good read.
2.4 How to Add Files to Existing Archives
http://www.apl.jhu.edu/Misc/Unix-info/tar/tar_28.htmlCame across the need to add a file to a tar archive. Doesn't seem to be in the quick help; perhaps the man pages do.
tar --append --file=afiles.tar arbalest
linux - Any way to exit bash script, but not quitting the terminal - Stack Overflow
http://stackoverflow.com/questions/9640660/any-way-to-exit-bash-script-but-not-quitting-the-terminalI was using exit to stop all processing and not continue. It worked alright, but it would always kill my terminal session.
Instead of using exit, you will want to use return.
Dominik Honnef, http://stackoverflow.com/questions/9640660/any-way-to-exit-bash-script-but-not-quitting-the-terminal
No comments:
Post a Comment