Tag Info

New answers tagged


In zsh or yash. export -p myvariable myvariable2 would work as you'd expect. Otherwise, in bash, you can still do: for var in myvariable myvariable2; do printf 'export %s=%q\n' "$var" "${!var}" done POSIXly, you can do the quoting by hand using awk: awk -v q="'" ' function escape(v) { gsub(q, q "\\" q q, v) return q v q } BEGIN { ...


The POSIX standard that was derived from the Bourne Shell and it's descendant ksh88 explicitly mentions that this is not granted to work. The reason is the shell syntax: <>file opens stdin for reading and writing, and: [n]<>file opens file descriptor n for reading and writing. n in this case is a single digit. You used the number 99 and ...


POSIXly: [ "$((hex_string_1))" -eq "$((hex_string_2))" ] With older versions of dash, you needed: [ "$(($hex_string_1))" -eq "$(($hex_string_2))" ] POSIXly, About: [ "$hex_string_1" -eq "$hex_string_2" ] The POSIX specification for the [ aka test utility says operands have to be integers, without specifying which forms of integers (decimal, octal, ...


You could always use printf to convert to decimal and compare that as @ott-- suggested: [ $(printf "%d" "$hex_string_1") -eq $(printf "%d" "$hex_string_2") ] && echo y Or if [ $(printf "%d" "$hex_string_1") -eq $(printf "%d" "$hex_string_2") ] then echo y fi


sh only loads .profile if it's a login shell, i.e. if it's invoked with argument 0 starting with -. So if you don't want /etc/profile and ~/.profile to be read, invoke the shell with the default argument 0 (the name of the executable). If something is executing the shell as a login shell, you don't have control over arguments. If not, the shell isn't a ...


Doesn't look like it. You can find the code at the link below. Seems there are no flags to control this behaviour. http://git.kernel.org/cgit/utils/dash/dash.git/tree/src/main.c#n147

Top 50 recent answers are included