77,127 reputation
1082181
bio website
location European Union
age
visits member for 1 year, 11 months
seen 2 hours ago

Jun
17
awarded  Nice Answer
Jun
17
comment File ID that doesn't change upon rename
the combination of st_dev + st_ino + st_birthtim (on systems that have it) should make it reliable. Otherwise, you could have issues if inode numbers are reused.
Jun
17
revised “including” files in fstab
added 4 characters in body
Jun
17
comment Array in unix Bourne Shell
Yes in POSIX shells, you should prefer $(...) over `, but the OP's /bin/sh is probably a Bourne shell, not a POSIX shell. Beside seq not being a standard command, doing $(seq 100) means storing the whole output in memory, and that means it depends on the current value of $IFS containing newline and not containing digits. Best to use i=1; while [ "$i" -le 100 ]; ...; i=$(($i + 1)); done (though that wouldn't work in the Bourne shell either).
Jun
17
revised Array in unix Bourne Shell
added 129 characters in body
Jun
17
comment Array in unix Bourne Shell
@NoobGeek, the Bourne shell doesn't have the $(...) syntax. So you must indeed have the Bourne shell. Are you on Solaris 10 or before? Chances are you won't have a seq either. On Solaris 10 and earlier, you want /usr/xpg4/bin/sh to have a standard sh instead of a Bourne shell. Using seq that way is not very good either.
Jun
17
comment Rename files with spaces in a BusyBox shell
Since the touch command works, it looks more like it's a problem with mv than with the shell. I suspect that mv is a (poorly written) shell script. What does type mv tell you. What about file /path/to/mv assuming file is available?
Jun
17
comment bash script [ x$1 = x ]
@glennjackman, that last sentence is incorrect. Solaris 10 still is the most widely deployed version of Solaris and [ "$1" = "" ] still doesn't work with its /bin/sh (though you'd want to use /usr/xpg4/bin/sh there, not /bin/sh). dash was fixed in that regard in January 2009.
Jun
17
comment bash script [ x$1 = x ]
@MacLemon, the OP also has #!/bin/sh in his script so he's obviously confused as to what bash or sh are or are meant to be.
Jun
17
revised Array in unix Bourne Shell
added 184 characters in body
Jun
17
answered Array in unix Bourne Shell
Jun
17
comment how to set and use multiple parameters in single environmental variable in fish shell
Though it sounds like it's what the OP is asking, I don't think it is what he wants.
Jun
17
answered how to set and use multiple parameters in single environmental variable in fish shell
Jun
17
revised bash script [ x$1 = x ]
fix some confusion with testing for empty wrt testing for non-empty.
Jun
17
revised Protected environment variables?
added 46 characters in body
Jun
17
comment How can we know who's at the other end of a pseudo-terminal device?
Thanks, but that's not what I'm looking for. Above for instance, I'd like to find the pid of the terminal application (Xterm/gnome-terminal...) that corresponds to /dev/pts/4, where you ran that w command.
Jun
16
answered Protected environment variables?
Jun
16
comment bash script [ x$1 = x ]
[ x$1 = x ] will also evaluate to true if $1 is for instance " -o x". Try sh -xc '[ x$1 = x ] && echo yes' sh ' -o x'. [ x$1 = x ] is wrong and doesn't make sense.
Jun
16
comment bash script [ x$1 = x ]
No x$1 is not quoted, so splitting and globbing is performed on those.
Jun
16
comment bash script [ x$1 = x ]
[ x$1 = x ] is also true if $1 is for instance " -o x". Try sh -xc '[ x$1 = x ] && echo yes' sh ' -o x'. [ x$1 = x ] is wrong and doesn't make sense.