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

Re: Bashism (Was: Locale testing)



2008/12/6 Tzafrir Cohen <tzafrir@cohens.org.il>:
>  VAR="value" command
>
> will run 'command' with the variable VAR set to "value".
>
> This is why you get a strange error with the following:
>
>  VAR=value with spaces
>
> It will complain about trying to run the command 'with spaces' (or
> rather: command 'with' with parameter 'spaces').
>
>> nor the export command, but why is the "exec" preferable?
>
> exec (like all the exec* system calls) replace the current process.
>
> Try an 'strace -f' following script:
>
>  #!/bin/sh
>  exec /bin/true
>
> which will show you that no forking was done, vs:
>
>  #!/bin/sh
>  /bin/true
>
> Which runs /bin/true in a sub process, waits for it to exit and only
> then exist.
>

+5 Informative, thanks!

-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه‍-و-ي
А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я
а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я
ä-ö-ü-ß-Ä-Ö-Ü

Reply to: