Results 1 to 6 of 6
Hello,
I need some direction on a small scripting question. I've been doing some development and storing the code on a network drive with multiple user access. My development is ...
- 07-21-2010 #1Just Joined!
- Join Date
- Jul 2010
- Posts
- 3
print message when changing directories
Hello,
I need some direction on a small scripting question. I've been doing some development and storing the code on a network drive with multiple user access. My development is getting complex enough that it is time to set up a svn repo for it. I would like to set up a little script (if possible) that prints a message/reminder to whomever is accessing the code directory stating that the code is ultimately stored in svn and any changes need to be checked in, etc. Is there a way to have linux print a message to the screen based on a 'cd /specific_dir/' command? So far google is mum on the topic. Using Debian and bash shell. Thanks.
- 07-21-2010 #2Linux Newbie
- Join Date
- Apr 2007
- Posts
- 119
My opinion if you want it is, send an e-mail to all users telling them that at XX time on XX date, the code will be moved to the SVN server and will no longer be available on the network drive. Submit all changes before then to have them incorporated.
As for your question, I cannot think of a way to do it.
- 07-21-2010 #3Linux Newbie
- Join Date
- Mar 2010
- Posts
- 121
Well, the "usual" thing to do would be to leave a file called README with those sorts of instruction in, but I guess you could do that if you created a wrapper for bash and parsed each line for the 'cd /whatever/' command, then you could spit out what you want. Just remember to pass everything to/from bash, of course!
- 07-21-2010 #4Just Joined!
- Join Date
- Feb 2008
- Posts
- 17
wrapper
rename /bin/cd to /bin/cd.orig
create /bin/cd
and give execute permissions.
You can put whatever you want in /bin/cd as long as you call cd.orig $1
Probably execute cd.orig $1, and then check `pwd` with your directory location.
But for your need, the best thing is to delete that directory as soon as the repo is ready!
- 07-22-2010 #5
Sorry, I think changing system binaries (like cd) is always an extremely bad idea.
Defining a command alias in the .profile or /etc/profile is a better way if this is the way you want to go.
The 'cd' command is a (bash) shell built in command anyway, so changing the /bin/cd binary won't work.
- 07-22-2010 #6
BTW: The challenge you have with printing a warning message based on a cd-command, is that you'll have to manage the use of $VARIABLES ~ . .. // \ in your little script correctly....


Reply With Quote
