Skip to main content

Posts

Showing posts with the label linux path

How does Shell find out which command/script I am trying to execute?

This is nothing new but yet I thought why not document it so that its etched into my memory (Ya I know I am selfish ) When you run a command or try executing a shell script, the shell first tries to look if your script is found in the Current Directory. To execute a shell script you should be in the same directory where it was created/written. Now this isn’t possible always – so what to do? There are two ways:   Method 1 - When you are executing the script, give the full path to the script! Now if you go by the usual file/folder structure in most of the software engineers – you can go crazy with the paths – the depth at which the script is found can drive you insane   So thankfully we have another way   Method 2 - Add the folder of your script to the PATH variable. What I suggest is create a folder for all your scripts – say myScripts and then add this to your PATH variable. If you are new to using the PATH variable, I suggest you go through this link on PATH ...

Set PATH

Whatever role you are into, this task comes to you eventually where you have to setup your environment! Setting up your classpath/path including... So here is how you can do it! Two ways: Method one - Setting up the path just for the particular session For LINUX: export PATH=$PATH:/home/gvsiri/apache-ant-1.8.2/bin For Windows: set PATH=%PATH%;.;C:\SirishaGV\Software\apache-ant-1.8.2\bin Method two - setting up the path for the profile For Linux: Modify the .bash_profile file For Windows: Change in the environment variables