News, tips, partners, and perspectives for the Oracle Solaris operating system

pfexec tip

Guest Author
How many times a day do you type a command in which you inadvertently forget to prepend with pfexec? For example:
bleonard@opensolaris:~$ zfs set compression=on rpool
cannot set property for 'rpool': permission denied

Rather than reentering or editing the previous command, you can quickly re-run it using:
pfexec !!

is the bash shortcut for running the previous command.

Join the discussion

Comments ( 5 )
  • Marc Poljak Wednesday, April 29, 2009

    Very nice!

  • ddosia Wednesday, April 29, 2009

    you can simply run "pfexec bash" ;-)

  • Marc Wednesday, April 29, 2009

    I know this feature, but I usually don't feel safe using it. I feel safer if I can see the actual line, either using TAB between !! and RETURN in zsh, or simply using the up arrow, CTRL+A and adding pfexec at the beginning of the line.

  • Dave Tuesday, August 25, 2009

    What would be the ksh93 equivalent?

  • jake Tuesday, October 6, 2009

    bangbang is actually a csh thing, not a Bourne shell thing. Apparently the nice bash people tacked it on at some point, which was certainly a good move. It'd be nice if they would endeavor to learn more yet from the csh folks.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.