[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: not in X. man command does not respect set bell-style visible



Dom <toyer@rpdom.net> wrote:
>On 01/03/12 20:40, Claudius Hubig wrote:
>> Andrei POPESCU<andreimpopescu@gmail.com>  wrote:
>>> On Jo, 01 mar 12, 18:02:40, Claudius Hubig wrote:
>>>> ->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->
>>>> #!/bin/sh
>>>> /bin/less -q $*
>>> I've read somewhere that "$@" (including the quotes) is safer in such
>>> situations.
>Note the "4 5" on the second set of args

Thank you very much! And contrary to my intuition, this is also
‘problematic’ when one just wants to pass ‘everything’ to another
script. To avoid further potential problems with Bash, I wrote a very
tiny Python script that will print out the command line arguments:

$ cat t.py 
#!/usr/bin/python
import sys
print sys.argv

This is then called from a bash script:

$ cat t.sh 
#!/bin/bash

printf 'Using $*:\n'
~/t.py $*

printf 'Using $@:\n'
~/t.py "$@"

The result was rather surprising to me but is in agreement with your
earlier findings:

$ ./t.sh 1 2 "3 4" '5 6' "7 '8 ' 9"
Using $*:
['/home/claudius/t.py', '1', '2', '3', '4', '5', '6', '7', "'8", "'", '9']
Using $@:
['/home/claudius/t.py', '1', '2', '3 4', '5 6', "7 '8 ' 9"]

Best regards, and, again, thank you very much,

Claudius
-- 
He who has imagination without learning has wings but no feet.
Please use GPG: ECB0C2C7 4A4C4046 446ADF86 C08112E5 D72CDBA4
http://chubig.net/ http://nightfall.org



Reply to: