Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-11-2004, 03:54 PM   #1
Senior Member
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Rep: Reputation: 45
How to create a ".bat" equivalent file

I just need to create a little script that does the below when I execute it.

rm -f /home/ken/.etwolf/etmain/profiles/CheewagaCheewaga/
rm -f /home/ken/.etwolf/etpro/profiles/CheewagaCheewaga/

How would I go about creating this?

**whoops, this should've went in the Linux NEWBIE section, not the software section.
Old 11-11-2004, 04:05 PM   #2
Registered: Oct 2004
Distribution: Slackware
Posts: 376

Rep: Reputation: 31

rm -f /home/ken/.etwolf/etmain/profiles/CheewagaCheewaga/
rm -f /home/ken/.etwolf/etpro/profiles/CheewagaCheewaga/

Save that to a file, then make it executable with:
"chmod +x insert-filename-here"
Old 11-11-2004, 04:18 PM   #3
Registered: Jan 2004
Location: Duesseldorf /Germany
Distribution: Gentoo amd64 / Debian
Posts: 226

Rep: Reputation: 30
Creating shel scripts

To create a shell script, (a batch file in the linux world)
open your favorite editor and edit new file.
The name does not realy matter in linux but "" would be a nice one.
Note that the extension .sh is not mandatory in linux,
as opposed to windows where batchfiles must have a .bat extension.

in your editor type:
rm -f /home/ken/.etwolf/etmain/profiles/CheewagaCheewaga/
rm -f /home/ken/.etwolf/etpro/profiles/CheewagaCheewaga/

And save this 3 line file.

The first line indicates which shell enviroment should execute the script.
Normaly /bin/bash is what you want, but you may also write in Perl or any even php for that matter.
(But if you use php you should point to the php command line interpreter)

Now to make the scrip executable do a:

chmod 0700

This will set the owner_user read / write / execute permissions on this file to true, all other users may not
read write or execute this script.

If your script lies in your current directory you can do:

to start it.
(normaly command/scripts from the current directory will not run for security reasons, ask if you want to know why....)

The other method would be to mv the file to /urs/local/bin (as root) so it will be in your search path.

Hope this helps.

read the bash scripting howto for more info:
Old 11-11-2004, 04:23 PM   #4
Registered: Dec 2003
Location: Central New York
Distribution: RH/Fedora/SUSE
Posts: 64

Rep: Reputation: 15
Zhangmaike is perfectly correct in what he says.

For consistancy, you might want to give the file a .sh (as in shell) extension. Not that bash cares like MS operating systems would, but it is a convention.

The other thing I would mention is that unless you write the file to a pathed directory, you will have to either specify the full path of the file or be in the file's directory and call it as sh ./

I keep a user pathed ~/bin directory for my shell and perl scripts. You can edit your .bash_profile file to add that directory to your path if you choose.

Sorry if these were things you were already aware of.

Jim Dishaw


Looks like I was posting at the same time as another poster. Once I submitted my post I saw his. I'm not just repeating his post.

Last edited by dishawjp; 11-11-2004 at 04:25 PM.
Old 11-11-2004, 04:41 PM   #5
Senior Member
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Original Poster
Rep: Reputation: 45
Thanks for all your help!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
vsftpd & "553 could not create file" steffentchr Linux - Server 8 06-28-2012 02:52 PM
Is there a "kudzu.conf" or equivalent file slackist Linux - Newbie 7 01-22-2010 10:18 AM
Red hat Install: "No valid devices found on which to create new file systems" Lucky_69 Linux - Software 1 02-06-2007 10:19 PM
"Attempting create too large a file system" suguru Linux - Hardware 2 02-23-2004 02:16 AM
"mkdir: cannot create directory `foo': Read-only file system" on FAT32 maddes Linux - Hardware 1 11-26-2003 07:19 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:22 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration