in reply to Backticks to capture umask output

There is no umask executable.

$ perl -E'say `umask` // ( $! != -1 ? $! : sprintf("\$?=%04x", $?) );' No such file or directory

You are trying to execute a bourne shell command without involving a bourne shell. So invoke the shell:

$ perl -E'say `/bin/sh -c umask` // ( $! != -1 ? $! : sprintf("\$?=%04 +x", $?) );' 0077

Of course, you should just use the builtin umask.

$ perl -E'my $umask = umask; say defined($umask) ? sprintf("%04o", $um +ask) : $!;' 0077

Replies are listed 'Best First'.
Re^2: Backticks to capture umask output
by austin43 (Acolyte) on May 24, 2011 at 20:58 UTC
    Nevermind I get what you're saying. I tried invoking /bin/sh and it worked! Thanks alot.
Re^2: Backticks to capture umask output
by austin43 (Acolyte) on May 24, 2011 at 20:56 UTC
    When I type 'umask' into the terminal (using bash) it outputs 0037 though...
      So use «/bin/bash -c umask» instead of «/bin/sh -c umask»
      Yes, but what's your point?