Skip to main content

All Questions

0 votes
1 answer
57 views

value of $VAR already contains backtick and/or single quote inside. How to handle it? How to properly pass $VAR to program? [duplicate]

$ bash --version GNU bash, versione 5.2.26(1)-release (x86_64-pc-linux-gnu) I don't know how to deal with $VAR when its value inside contains single quote (') and/or backtick (`). I'm in the need of ...
dAllARA's user avatar
  • 33
0 votes
3 answers
2k views

"bash: !/bin/su": event not found" [duplicate]

I have line in script which is working, but not working from command line. echo "User ALL = NOPASSWD: ALL, !/bin/su" | sudo tee -a /etc/sudoers [user@localhost ~]$ echo "test ALL = NOPASSWD: ALL, !/...
Panda's user avatar
  • 111
7 votes
3 answers
35k views

How to add a line break inside a bash string? [duplicate]

I have the following bash string and I need to add a line break to it, before the 'Hello' string: bash -c "echo 'Hello' > /location/file" I already tried adding it with different variations of ...
user avatar
1 vote
2 answers
2k views

Shell eating `?` characters

This is such a simple question that I'm sure it's been asked somewhere, but I can't find it. My shell, which I have not intentionally set up to do so, seems to eat any words involving question marks: ...
LSpice's user avatar
  • 113
0 votes
2 answers
3k views

Define string with the characters *, single quote and $

I create bash scripts which get sourced from another "main" script to set up variables needed by the main script. These variables need to be able to contain any character and not have them ...
Peter Grill's user avatar
  • 1,613
7 votes
1 answer
3k views

Representing/quoting NUL on the command line

Can \0 be used on the command line? Background For testing corner cases in GNU Parallel I was curious whether all characters were correctly quoted on the command line. Most of them are: perl -e '...
Ole Tange's user avatar
  • 35.8k
188 votes
7 answers
179k views

Can't use exclamation mark (!) in bash?

I'm trying to use the curl command to access a http url with a exclamation mark (!) in its path. e.g: curl -v "http://example.org/!287s87asdjh2/somepath/someresource" the console replies with bash: ....
netbrain's user avatar
  • 2,235
10 votes
2 answers
5k views

Difference between ' and " on command line (bash)? [duplicate]

I used to use '' and "" (single and double-quotes) interchangeably on the command line, but I recently noticed that '$HOME/some/dir' is not expanded, while "$HOME/some/dir" is. I searched around a ...
apoorv020's user avatar
  • 1,283