[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: Shell Scripting (Was Re: [LIH] at problem)
On Thu, 22 Jun 2000, Sachin Garg wrote:
> "Lakshmi B. G." wrote:
> > cd /usr/local
> To do what u want to do do:
> cd /usr/local
> This says that one should use /bin/sh to interpret the remaining part of
> the script.
IMO you won;t be able to do what you want to do by executing this
script. When we execute a file it is run in a new shell and hence whenn
you finish you would be where you are.ie if you write the above command in
a file say l.txt make it executable and run it then it won;t change your
current directory. The only way i know is running the script in the
current shell using
$ cat >l.txt
#!/bin/sh # works without this line also
$ chmod 755 l.txt
$ . l.txt
Using the . "command" ( I don't think its a command) tells the
shell to run in in the current shell and not to fork a new shell. In this
way one can change the current shell.
But IMO(In my Opinion) we can't use the at command to do this
because it is not something the at is meant for. I think it is meant to do
something at a specified time when we don;t know if we would be "online".
Hopefully we can't ask at to run the command in the current shell.
Further enlightment about this is solicited.
Bye and Enjoy...............
Ajay kumar Dwivedi