Skip to main content

All Questions

0 votes
2 answers
884 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
  • 101
0 votes
1 answer
45 views

Script Integer getting prefixed with "

I am running a jar file using a very basic shell script (I literally just need this to run on startup of a NAS). However, I am getting some rather unexpected behavior: Script looks like this: java -...
Nico-Ben de Villiers's user avatar
2 votes
1 answer
81 views

Generating quoted command arguments

I'm working with a HTTP API that demands a very particular set of signed headers + JSON body. And I really want to cURL it for debugging and sanity in general. So, I've written a small script that, ...
Morten Siebuhr's user avatar
2 votes
2 answers
1k views

Keeping quotes passed to a perl wrapper script

I'm writing a small perl wrapper to setup environment variables, etc., then invoke a command by the same name. ./foo.pl -a one -b two -c "1 2 3" -d done When I output @ARGV, the "" around 1 2 3 have ...
alfinator's user avatar
3 votes
1 answer
6k views

Passing arguments with spaces and quotes to a script (without quoting everything)

The following works great on the command-line: $ ffmpeg -i input.m4a -metadata 'title=Spaces and $pecial char'\''s' output.m4a How do I parameterize this command and use it in a script/function? I ...
Leftium's user avatar
  • 173
9 votes
4 answers
3k views

Can a shell script prints its argument, quoted as you would write them on the shell prompt?

In a shell script, my understanding is that "$@" expands to the script arguments, quoting them as needed. For instance this forwards the script arguments to gcc: gcc -fPIC "$@" When using the bash ...
Alex Jasmin's user avatar
3 votes
2 answers
10k views

Passing paths with spaces as arguments

I am having difficulty in passing some string variables having spaces in them as arguments to a program. For debugging and showing the arguments being passed, I created a demo Python script -: #####...
Anmol Singh Jaggi's user avatar
1 vote
2 answers
2k views

UNC Argument in bash scipt

I want to create a bash script with a "pure" UNC (i.e. I do not want to escape the backslashes literally) as an argument, i.e. something like: ./foo \\my\share\is\here However, as is natural, the ...
trikelef's user avatar
  • 411
1 vote
2 answers
578 views

Can't use argument in bash date calculation script

The following bash script won't work. I need to calculate the date depending on the number of days since 14th Oct 1582, where the argument will be the number of days. d="$1" date -d '14 Oct 1582 + "$...
Jacques MALAPRADE's user avatar
0 votes
2 answers
3k views

Making md5sum understand file names with spaces

I need to use md5sum in Python by using pipe to calculate checksum for a bunch of .mp3 files... is there a command which ignore whitespaces in filenames on the command line of md5sum program? For ...
Reloader's user avatar
  • 103