![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sourcing the .bashrc | Nusy | UNIX for Dummies Questions & Answers | 3 | 05-27-2008 05:23 PM |
| alias rm = 'rm -i' in .bashrc and vnc | cy163 | UNIX for Dummies Questions & Answers | 0 | 05-23-2007 09:57 AM |
| history -c in my .bashrc | yankee428 | UNIX for Dummies Questions & Answers | 1 | 06-23-2005 04:13 PM |
| xterm font colors - configuration question? | ripley | Linux | 3 | 04-14-2005 11:11 AM |
| from bashrc to sh..?? | moxxx68 | Shell Programming and Scripting | 3 | 09-13-2004 05:39 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
.bashrc question re: rm -i & ls --colors
QUESTION #1:
I have this in my .bashrc file: alias rm='rm -i' Problem is, there are 3 files that I remove many times a day and would like this command to ignore these 3 files. In other words, prompt me on everything EXCEPT these 3 files. Is this possible? QUESTION #2: Also in my .bashrc file is this: alias ls='/usr/local/bin/ls --color' My colors will not work if I have just 'ls --color'. My colors only work if referenced to /usr/local/bin/ls --color. Can I modify the color scheme? So that it only affects me, not everyone else? |
|
||||
|
Q1. Some possiblities:
Quote:
Code:
alias ls='ls --color=auto' |
|
||||
|
Quote:
Code:
rm () {
local ask
ask="-i"
case $# in 1)
case $1 in your|excluded|files) ask= ;; esac ;;
esac
/bin/rm $ask "$@"
}
Quote:
Last edited by era; 04-21-2008 at 01:21 PM.. Reason: Actually, look at dircolors -p output |
|
||||
|
Thanks for your response, but ....
Q1. - change the permission of these files --> Our application creates these files on startup. Prior to restarting our application, these files must be deleted. Ideally, my request needs to go through our development team to modify the application start/stop --- but until then, I need to do it manually. - preface the filename with a dot to make them hidden --> same as above - use a script to remove the desired files --> agreed, this would work, but ... I still want to know if it's possible to use rm -i (or an alternate rm option) to prompt on all files EXCEPT for 3 specific files (work log tmp). Q2. alias ls='ls --color=auto' --> maybe I should clarify: my colors do not work at all if I use ls --color OR ls --color=auto. My colors ONLY work if referenced to /usr/local/bin/ls --color. So, my question remains: Can I modify the color scheme? So that it only affects me, not everyone else? |
|
||||
|
Create a wrapper script which removes the files, then starts the application.
Code:
#!/bin/sh rm -f work log tmp exec /path/to/application Earlier you said the ls alias pointed specifically to /usr/local/bin/ls. If it doesn't then it's likely that another version of ls is in your PATH before /usr/local/bin/ls -- one which doesn't understand, or ignores the --color option. (What does "which ls" or "type -all ls" print for you?). If so, just put in the entire path /usr/local/bin/ls in the alias. Last edited by era; 04-21-2008 at 01:37 PM.. Reason: Suggest which ls or type -all ls; pointer back to earlier comment |
|
||||
|
Sorry -- I did not see the response from era -- i must have been posting at the same time ... I will review and respond shortly.
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| linux |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|