Package: devscripts
Severity: wishlist
Version: 2.10.20
User: [EMAIL PROTECTED]
Usertags: checkbashisms
Tags: patch

While checking for more bashisms affecting the dash as /bin/sh RG I noticed 
that 'export -n' is a bashism.

Trivia:
----
$ cat exportn
#!/bin/sh

FOO=bar
export FOO
$SHELL -c 'echo $FOO'
export -n FOO
$SHELL -c 'echo $FOO'
$ bash ./exportn
bar


$ zsh ./exportn
bar
./exportn:6: bad option: -n
bar
$ ksh ./exportn
bar
export: -n: unknown option
Usage: export [-p] [name[=value]...]
$ posh ./exportn
bar
export: invalid option -- n
bar
$ pdksh ./exportn
bar
./exportn[6]: export: -n: unknown option
$ dash ./exportn
bar
export: 6: Illegal option -n
----


export -f also seems to be a bashism (only zsh doesn't scream when export -f 
is called).

Cheers,
-- 
Atomo64 - Raphael

Please avoid sending me Word, PowerPoint or Excel attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
Index: checkbashisms.pl
===================================================================
--- checkbashisms.pl	(revision 1230)
+++ checkbashisms.pl	(working copy)
@@ -179,6 +179,7 @@
 		'(?:^|\s+)local\s+\w+=' =>     q<local foo=bar>,
 		'(?:^|\s+)\s*\(?\w*[^\(\w\s]+\S*?\s*[^\"]\(\)' => q<function names should only contain [a-z0-9_]>,
 		'(?:^|\s+)(push|pod)d\b' =>    q<(push|pod)d>,
+		'(?:^|\s+)export\s+-[nf]+\b' =>    q<export -[nf]>,
 	    );
 
 	    my %string_bashisms = (

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to