Skip to main content

Questions tagged [quoting]

Strings are typically delimited by quotes, which raises the problem of dealing with strings that include quotes.

2 votes
1 answer
2k views

escaping filename results from grep

How do I escape the output of grep so that bash can read the file names correctly? I have a text file that is the output of a find command. For each line, I want to make a symlink. For now, I'm just ...
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 ...
18 votes
4 answers
5k views

Is there a command to write text to a file without redirection, pipe or function?

Pipes and redirection are two of the most powerful functions in Linux, and I love them. However, I'm stuck with a situation where I need to write a fixed piece of text to a file without using a pipe, ...
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 ...
4 votes
2 answers
1k views

Is there a way to printf $@ verbatim?

I want to write a script that echoes to stdout its $@ verbatim, including any potential double-quotes, without a newline. What I have tried: > cat ./script1 #! /usr/bin/bash printf "%s %s" $0 ...
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. ...
4 votes
3 answers
2k views

How to pass argument with char ( in remote path?

I'm trying to move a file with rsync to a remote location, The file has be be named : DRRS_(H264).mp4 but when I try : rsync -azR output.mp4 [email protected]:encoded/somepath/DRRS_(H264).mp4 it ...
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
65 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 ...
2 votes
1 answer
474 views

rsync does not exclude specified directory starting with a hash character (#)

I am trying to exclude the #recycle directory with rsync: $ rsync -Hauv -h -P --exclude '#recycle/' --exclude @eaDir/ --exclude '.DS_Store*' --exclude desktop.ini user1@src_server:/volume2/...
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 ...
0 votes
2 answers
2k views

Exclude the output from ssh and only log the error if found

typeset -f | sshpass -e ssh -o StrictHostKeyChecking=no user@${IPADDRESS} " $(cat); IFERROR=$(checkscript); echo "$IFERROR"" > ${SSHTEMPFILE} 2>&1 This line...I can't exclude the "...
-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 ...
34 votes
4 answers
167k views

What is the difference between echo `date`, echo "`date`", and echo '`date`'?

What is the difference between these three commands? echo `date` echo "`date`" echo '`date`' I am confused on what the differences actually are. I think that when the ' are around it means that it ...

15 30 50 per page
1
2 3 4 5
72