Questions tagged [quoting]
Strings are typically delimited by quotes, which raises the problem of dealing with strings that include quotes.
1,075
questions
0
votes
1
answer
46
views
passing parameters to driver
I'm doing a Linux driver tutorial, and I have encountered a problem
with the sample lesson of passing parameters to the driver.
I tried another parameter-passing example I found on the internet
with ...
0
votes
2
answers
37
views
How to escape both single quotes and exclamation marks in bash
I have a long command and I just want to use alias to shorten it. But the command contains single quotes and exclamation marks.
The origin command is ldapsearch -x -H ... -w 'abc!123'.
I tried alias ...
3
votes
1
answer
238
views
tcsh: Handle spaces in arguments when passing on to another command
I wrote a script that needs to call a command and pass on arguments. My script has its own parameters but some need to be passed through. This fails when arguments to my script have spaces in them.
...
0
votes
0
answers
71
views
Why are my strings being truncated including and after an equals sign?
I was writing a shell script for inserting a string value through a Microsoft sqlcmd variable into a Microsoft SQL server database table and noticed some unexpected behavior. It appeared the trailing ...
0
votes
1
answer
63
views
How to use grep string that has double quotes in it
So I'm running a simple alias called vpn which runs a command and has an output, which I put into a .txt file.
If interested to what exactly then here is the alias
alias vpn="docker exec -it ...
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 ...
-1
votes
1
answer
42
views
I can't grep some inputrc string
bind -p |grep -E "\\e.\":" work
but
bind -p |grep -E "\\e\\C-.\":" don't work
I tried a lot of combination
5
votes
1
answer
450
views
ls output display a file named "N'*" as "N'\''*"
System:
Ubuntu 22.04.3 LTS
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
ls (GNU coreutils) 8.32
Situation:
$ touch "N'*"
$ ls
'N'\''*'
"GNU Coreutils - Quoting File ...
1
vote
1
answer
117
views
bash cd issue with path containing spaces: "too many arguments" [closed]
I created a path with spaces, and when I try to change directory I get "too many arguments" error message despite escaping the spaces or quoting the path :
Here are the tests I made :
# ...
0
votes
1
answer
43
views
Replace string ${FOO} by ${'$'}{BAR} with sed
I have this string occurring N times in a file: ${FOO}
that I have to replace by this string: ${'$'}{BAR}
This is my current state:
sed "s/\\${FOO}/\\${'\\$'}{BAR}/" file.txt but it raises &...
-1
votes
3
answers
94
views
How to use a variable in a command inside of a bash file
I use this command directly on our redhat linux server 8.8 and it's working correctly and I get the result I want:
grep '01-FEB-2024' /u01/app/server1/listener_scan/trace/listener_scan.log | awk '{ if ...
0
votes
0
answers
59
views
Why isn't passed quoted $@ a single argument? [duplicate]
Why isn't passed quoted $@ a single argument?
f2()
{
echo "f2: $1"
}
f1()
{
local x=("$@")
f2 "${x[@]}"
}
f1 x y
Invocation:
$ bash t537.sh
f2: ...
0
votes
0
answers
45
views
escape in double and single quotation [duplicate]
I am confusing why bash can escape "..." but can't escape '...'? Can some one give me a hint? Thanks
test@test:~$ echo "He said, \"Hello world\""
He said, "Hello ...
0
votes
1
answer
77
views
How can I create a file named "\?$*'ChouMi'*$?\"?
I need to create a file with this exact name "\?$*'ChouMi'*$?\" so that ls would show it as:
$ ls | cat -e
"\?$*'ChouMi'*$?\"$
$
1
vote
1
answer
99
views
Why does -n with unquoted variable containing empty string return true? [duplicate]
From man bash:
-n string
True if the length of string is non‐zero.
Examples:
# expected
$ var=""; [ -n "$var" ]; echo $?
1
# unexpected?
$ var=""; [ -n $var ]; echo ...