Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Here is a part of my zshrc file.

## Most Frequently used settings
# ls
alias ls='rm .DS_Store; echo --------------${PWD##*/}--------------; ls -1FGu'
alias l='ls -A'

I want to delete .DS_Store, every time I ls, if it exists, but, if it doesn't, I don't want warning from rm.

share|improve this question
1  
I dont think this is a particular good idea to have a (typical) side effect free command modified this way. You could add a auto mount script, so this is done only once you plug a device in. But then again if a friend of yours wants to peek on his flash drive he might not be happy about losing his Apple settings. , but yes rm -f –  eckes Aug 16 '12 at 0:19
add comment

1 Answer

up vote 3 down vote accepted

rm -f silences the nonexistent file warning.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.