It is absolutely working fine but as it is not changing the current directory you are saying it is not working. Try to run your script using source command. eg source <script name> <argument>
When u run the script, at time it creates a separate shell and do the operation in that shell and when programm terminates the shell also got killed. If you still have doubt, please let me know.
I don't think running cd in a shell script will actually jump to the directory. The directory path will still be static to your current working directory even after jumping
hey why don't u jst post all the lines that u executed along with the o/p u see on ur screen... line by line....
show us what exactly u type and what happens.
if theres' an undefined variable then there may be a spelling mistake in the variable "input" that u used...
what do u type in at the read input line?
does the directory exist???
in short:
carry out the following steps:
create a directory
$ mkdir varun
create a file change.sh and type in the nxt 2 lines
$ vi change.sh
~echo "enter a directory"
~read dir
~cd $dir
~
~
save the file and exit.
:wq!
"change.sh" 3L, 48C written
Now run this file
$ . change.sh
enter a directory:
varun
varun$
This thread has carried on too far now.
Just follow the steps above.
If it doesn't work then lets assume that u r using a customized version of unix which may have some differences.....
or u might not be disclosing all the relevant info thats needed
what do u type in at the read input line?
does the directory exist???
in short:
carry out the following steps:
create a directory
$ mkdir varun
create a file change.sh and type in the nxt 2 lines
$ vi change.sh
~echo "enter a directory"
~read dir
~cd $dir
~
~
save the file and exit.
:wq!
"change.sh" 3L, 48C written
Now run this file
$ . change.sh
enter a directory:
varun
varun$
This thread has carried on too far now.
Just follow the steps above.
If it doesn't work then lets assume that u r using a customized version of unix which may have some differences.....
or u might not be disclosing all the relevant info thats needed