All Questions
Tagged with shell-script quoting
231 questions
6
votes
3
answers
926
views
bash script quoting frustration
This problem is driving me crazy. From the command prompt I can enter this command and it works as expected (records where the INFO/RegionType tag contains the value Core are emitted in the output ...
5
votes
2
answers
611
views
Bash reads quotes inside a variable as text, not quotes? Is "Implicit quoting" a thing in Bash?
I've got a bash script that cleans up the mail queue periodically. For Reasons, we've elected to delete any email to @mms.att.net and other email2SMS gateways that are over 9 hours in the queue and ...
0
votes
1
answer
253
views
Unable to resolve parameter inside json
I'm using a curl command inside a script (edm.ksh) to retrieve some data from an API, it requires a password in a JSON like {"password":"myPassword"}. Now, myPassword is not ...
0
votes
1
answer
147
views
Using a variable in between ' 's
I have a bash script with a line that was originally this
convert '%d.jpg[1-300]' combined.pdf
Uses convert from Imagemagick to strap a load of sequentially numbered jpgs in to a PDF.
I've written a ...
4
votes
2
answers
783
views
How to print a double quote in POSIX scripting?
So far, I've been using "\"" to print a double quote:
$ x="abc def"
$ echo "x=\"$x\""
x="abc def"
However, it seems like that behavior is ...
3
votes
1
answer
416
views
Why is "${1-"$var"}" (option 6 down below) not mentioned in POSIX?
The only reference I could find in the spec is this:
It would be desirable to include the statement "The characters from an enclosed "${" to the matching '}' shall not be affected by ...
8
votes
1
answer
5k
views
What are curly quotes and can I use them in my code?
Somehow curly quotes got into my code and I'm getting unexpected behavior
#!/bin/sh
if [ foo = ‘foo’ ]; then
echo yes
else
echo no
fi
I would expect this to echo yes but instead it echoes no.
1
vote
2
answers
8k
views
unexpected EOF while looking for matching `''
I have created a script to export CSV data to mysql table.
#!/bin/bash
cd /data/NEW
for f in User*
do
mysql --user="root" --password="user@123" -e "LOAD DATA LOCAL ...
1
vote
2
answers
395
views
Please explain the behavior of these parameter expansions using IFS?
I'm trying to figure out how to use the ${parameter%word} expansion with $@ and $*. It started by trying to make a script to combine pdfs using ghostscript, but I ran into some weird behavior with ...
0
votes
2
answers
982
views
How to properly parse a quoted arg-list string in a shell script?
Summary
How to convert a single string a "b" 'c d' $'e\nf' into separate arguments, respecting quotes and preserving whitespaces and newlines?
Question
I'm trying to read and process the ...
4
votes
2
answers
1k
views
Bash's read builtin errors on a string-based timeout option specification but not an array-based one. Why?
In reading through the source to fff to learn more about Bash programming, I saw a timeout option passed to read as an array here:
read "${read_flags[@]}" -srn 1 && key "$REPLY&...
2
votes
2
answers
2k
views
Removing single quotes from double-quoted variable element in array and run a command [duplicate]
I have a script where I dinamically change the arguments which must be passed to a command (mkvpropedit in this case). Consider the example script below:
#!/bin/bash
LANG_NAME="eng lish"
...
2
votes
1
answer
841
views
issues with $ symbol while reading from positional parameters in unix shellscript
I have written the following script:
#!/bin/bash
TEST=$1
TEST_1=$2
if [[ "$TEST" == e ]];then
echo $TEST_1
else
echo "Input is not e"
fi
Now if I will run:
sh test.sh e NS3#$xX$...
1
vote
2
answers
978
views
How to quote exclamation marks in file names in a tcsh shell script with find and awk?
I have a script that searches for space characters ' ', exclamation marks '!' and dollar signs '$' in filenames and replaces each with an underscore '_'. However, it does not handle file names with ...
0
votes
0
answers
17
views
ASH scripting quotes in backticks works with echo but not with actual execution [duplicate]
I am creating a script for my router (running busybox).
In my script I generate a command in a variable like nvram set option='value with spaces' but when it is executed it complains that arguments ...