makeself icon indicating copy to clipboard operation
makeself copied to clipboard

Script arguments get split on spaces, passed as multiple arguments

Open spiffytech opened this issue 8 years ago • 0 comments

If an argument passed to my script contains spaces, even if the argument is quoted, my script receives each space-separated segment as a separate argument.

Ordinarily I would backslash-escape the spaces, but I'm running this self-contained .run file from an installer tool that doesn't give me that option.

Please update makerun to support script arguments with spaces, so I can e.g., pass in file paths with spaces in them and actually use makerun in my installer :)

I expect it's as simple as wrapping each argument in quotes inside $SCRIPTARGS?

/tmp/mkselftest 11:29:46 spiffytech@spiffywork _

$ cat src/echotest.sh 
#!/bin/bash

echo $1
echo $2
echo $3
echo $4


/tmp/mkselftest 11:29:49 spiffytech@spiffywork _

$ makeself-2.2.0/makeself.sh src test.run "Multi-arg test" './echotest.sh'                                                                                                                                                                    
Header is 498 lines long

WARNING: Overwriting existing file: test.run
About to compress 8 KB of data...
Adding files to archive named "test.run"...
./
./echotest.sh
CRC: 1342037018
MD5: 974773a52a5dc2a1614ef9ba8a80eeef

Self-extractable archive "test.run" successfully created.


/tmp/mkselftest 11:29:59 spiffytech@spiffywork _

$ ./test.run One "Two Args" Three                                     
Verifying archive integrity... All good.
Uncompressing Multi-arg test  100%  
One
Two
Args
Three


/tmp/mkselftest 11:32:01 spiffytech@spiffywork _

$ ./src/echotest.sh One "Two Args" Three
One
Two Args
Three

spiffytech avatar Oct 09 '15 15:10 spiffytech