Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

New TerminalBasics version 2.0 posted System
Neal Parikh has updated his TerminalBasics PDF to version 2.0, and it now includes a fairly extensive section on pico and emacs, and other sections have been rewritten and expanded. It's linked in the box at left, or just click here if you're feeling lazy ;-).
    •    
  • Currently 3.00 / 5
  You rated: 3 / 5 (1 vote cast)
 
[2,536 views]  

New TerminalBasics version 2.0 posted | 1 comments | Create New Account
Click here to return to the 'New TerminalBasics version 2.0 posted' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Adding a safety net to the command line
Authored by: jimhill on Aug 06, '01 01:41:32AM

The usual UNIX primers mention that commands such as 'rm', 'cp', and 'mv' don't have the usual "Are you sure?" confirmatory that is intended to keep users from blowing away files by (for example) changing a filename to something that already existed.

It's worth mentioning that all three of these commands support the "-i" flag that will interrogate (prompt) the user for a yes/no answer before taking action which will overwrite or delete an existing file. You can make this the default behavior by aliasing the commands in the shell startup (.tcshrc, .bashrc, whateverrc).

For example, in .tcshrc, use this: alias rm 'rm -i'

And in .bashrc, use: alias mv='mv -i'

The next time you launch a Terminal and issue the commands, the aliased version will run and protect you from potential missteps. Note that the aliased behavior can be overridden to restore default behavior by running the command with the "-f" (force) option.

Remember, the man pages are your friend. If you ever read an article about a UNIX command, please Please PLEASE do yourself a favor and read the man page. There's a wealth of information in them there pages!



[ Reply to This | # ]