How to create batch file?
my netscape 7.2 is in /usr/local/netscape
everytime i have to go to that folder and type ./netscape to launch it. in DOS, i can create a file named netscape.bat, inside typed cd /usr/local/netscape ./netscape in linux, how to do it? |
You don't really need a batch file (or a script in Linuxese) to do this. I'll show you two different ways.
1. Create an alias At the command line type this: Code:
alias netscape="cd /usr/local/netscape; ./netscape" 2. Modify your PATH environment variable. At a command line type this: Code:
export PATH=$PATH:/usr/local/netscape NOTE: with both of these methods, you'll need to completely log out if you make the change permanent. Opening a new xterm won't work. If you want to be absolutely sure, reboot the machine. |
what is this :
edit ~/.bashrc ~ mean what? the folder name? |
export PATH=$PATH:/usr/local/netscape"
$PATH is it the name of my folder? |
~ is a "shortcut" that means your home directory (Probably /home/tigerlinux)
~/.bashrc is a file in your home directory where you change the settings for the shell. $PATH is an environment variable that contains the list of directories where Linux will search for programs to execute. If you enter the command "echo $PATH", you will get an output like this "/bin:/usr/bin:/usr/X11R6/bin". This means that if you type a command, say "netscape", Linux will search /bin, then /usr/bin, the /usr/X11R6/bin for it. The command "export PATH=$PATH:/usr/local/netscape" will add /usr/local/netscape to the end of this list. There is another way to add netscape to your path - make a symbolic link to it in /usr/bin. This way, all users on your machine can "see" it. As root: Code:
ln -s /usr/local/netscape/netscape /usr/bin --Ian |
thanks
|
this is the most useful
export PATH=$PATH:/usr/local/netscape |
Quote:
become unmanagebly long. It would be useful if there were several programs in the same directory, but when there is only one a symbolic link is better. As far as I know, the "normal" way is the symbolic link, like I mentioned above, but who needs to be normal :) All the different ways of achieving the same thing all have their pros and cons in different situations. --Ian |
I want to mount multiple images and unmount them when my cp command has completed its task.
so... mount whatever here cp that to here umount whatever mount somethingelse here cp this to here umount somethingelse get the idea...? sorry for the crap example :) Also how do i run it. I tried making a .sh file and running it as follows ./example.sh and no chance of it working :( |
Make a new text file and the first line should be
Code:
#!/bin/bash Code:
chmod 744 example Code:
/path/to/example/srcipt/example |
I would have your children if I was a woman! :P
|
thanks, i need the info i asked before.
|
Another approach would be to move the executable (netscape in this case) from /usr/local to /usr/local/bin. This would be the normal resting place for a system specific executable file. /usr/local/bin is normally found in the PATH variable by default. On my system no individual files are found in /usr/local; only directories are there.
ciao, jdk |
jdkaye, this thread is several years old. It was only shown because another post was made to it today (and has since been split into a new thread).
|
Thanks for the heads-up Nylex. I hadn't noticed the date.
ciao, jdk |
All times are GMT -5. The time now is 02:10 AM. |