Skip to main content

All Questions

Tagged with
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 ...
mcrepeau's user avatar
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 ...
Criggie's user avatar
  • 1,831
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 ...
Pratik Khobragade's user avatar
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 ...
Big_James's user avatar
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 ...
finefoot's user avatar
  • 3,504
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 ...
QuartzCristal's user avatar
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.
jesse_b's user avatar
  • 40.4k
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 ...
edublog's user avatar
  • 93
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 ...
mangoduck's user avatar
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 ...
Christian's user avatar
  • 121
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&...
qmacro's user avatar
  • 143
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" ...
virtualdj's user avatar
  • 177
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$...
John's user avatar
  • 73
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 ...
Ned64's user avatar
  • 9,216
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 ...
ulvesked's user avatar
  • 101

15 30 50 per page
1
2 3 4 5
16