in reply to single quote problem with system()
You have single-quoted arguments inside of a single-quote argument:
so the ' before *.std* is the end of one single-quoted string. Since you have no space there, the shell ends up concatenating all of those bits together and trying to match a very long wildcard. The shell likely ends up passing the following arguments to expect:"expect -f '$theScript' '$cd' pwd 'find . -name '*.std*' -s (^^^^^^^^^^) (^^^) (^^^^^^^^^^^^^^) (^^^
but only if $theScript and $cd don't contain any ' characters and there were no files that matched the very long wildcard find . -name *.std* -o -name ULOG.* -mtime +9 -type f -exec rm {} ; (since none of the * characters were inside of single quotes as far as the shell was concerned).0: expect 1: -f 2: $theScript 3: $cd 4: pwd 5: find . -name *.std* -o -name ULOG.* -mtime +9 -type f -exec rm {} +\; 6: pwd
You'd be better off skipping the shell for this:
- tyesystem( 'expect', '-f', $theScript, $cd, 'pwd', "find . -name '*.std*' -o -name 'ULOG.*' -mtime +9 -type f -e +xec rm {} ';'", "pwd", );
|
|---|