[wplug] *.bat files

Embery, Nathan Nathan.Embery at crowncastle.com
Tue May 18 09:23:48 EDT 2004


Well, if I understand you correctly, it did actually. That script spawned a
new shell, which started in your current directory, created the newfile dir,
cded into it, and cleared the screen. Once that was done the script, and
hence the new shell for that script, exited returning execution to your
shell (which never moved)

Add a 'touch ScriptWasActuallyHere' line into your script after the cd and
you'll see that it did actually cd into that directory.

If you require that *your* shell be cded, then what you want is a function,
not a script. I learned this after trying to create a script to set up env
vars for me. LD_LIBRARY_PATH, CFLAGS, etc...

For ksh try this

# function make_and_move_into_dir {
> mkdir $1
> cd $1
> clear
> ls
> }


Nate

-----Original Message-----
From: Weber, Larry A [mailto:laweber at switch.com] 
Sent: Tuesday, May 18, 2004 8:55 AM
To: 'General user list'
Subject: RE: [wplug] *.bat files

Tried this batch file and found that it created a new directory and cleared
the terminal.  Would not cd to the new directory????

> -----Original Message-----
> From:	wplug-bounces+laweber=switch.com at wplug.org
> [SMTP:wplug-bounces+laweber=switch.com at wplug.org] On Behalf Of Jason Carr
> Sent:	Tuesday, May 18, 2004 8:06 AM
> To:	'General user list'
> Subject:	RE: [wplug] *.bat files
> 
> 1. Create a file called 'test.sh' and edit that file.
> 2. The first line should say #!/bin/sh
> 3. Put the rest of the commands on their own lines
> 4. The result should be as follows:
> 
> #!/bin/sh
> mkdir newfile
> cd newfile
> clear
> 
> The #!/bin/sh is which shell interpreter is used so you may need to change
> that depending on which Linux distro you use.
> 
> 5. To make it executable, type chmod u+x test.sh
> 6. Now you can type /home/jason/test.sh (or where ever it might be.
> 
> Any more questions, feel free to ask :)
> 
> - Jason
> 
> 
> -----Original Message-----
> From: wplug-bounces+jason=flacid.org at wplug.org
> [mailto:wplug-bounces+jason=flacid.org at wplug.org] On Behalf Of Amjed Ben
> Salah
> Sent: Tuesday, May 18, 2004 7:59 AM
> To: wplug at wplug.org
> Subject: [wplug] *.bat files
> 
> Hello,
> can someone tell me how to create files in linux like *.bat files in
> MSDOS?
> for example I want to create a program who does this:
> 
> 1 $> mkdir newfile
> 2 $>cd newfile
> 3 $>clear
> 
> regards
> _____________________________________________________________________
> Endlich SMS mit Bildern versenden! Das Bild selbst ist dabei gratis,
> Sie bezahlen lediglich den Versand. http://freemail.web.de/?mc=021195
> 
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
> 
> 
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
_______________________________________________
wplug mailing list
wplug at wplug.org
http://www.wplug.org/mailman/listinfo/wplug



More information about the wplug mailing list