Jump to content

Batch file


aze
 Share

Recommended Posts

you mean a shell script :-)

and depends on what you want. ou can running any script (just about) in any languauge (just about) from the command line

it can have any name, or any extension (it doesn't work like windows does)

example:

a perl script (thisismyscript.name)

#!/usr/bin/perl



insert perl stuff here

 

a php script (thisismyscript.name)

#!/usr/bin/php -q

<?

phpself();

?>

 

then to run it

you will need to make it executable

chmod 755 thisismyscript.name

then you should be able to execute it by doing

./thisismyscript.name

if that doesn't work try doing

perl ./thisismyscript.name

or

php ./thisismyscript.name

Link to comment
Share on other sites

thank you guys!

Actually I need make just simple actions like change a dir (cd) and execute a program (./)

In gnome when I click this file it opens like a simple text file. :(

 

probably it doesnt have the execute permission bits set. right click on it and go to the properties or something and make sure that its execution bits are checked...

 

or go to a terminal,change to the directory containing the script and issue

$ chmod +x {script_name}

.

 

ciao!

Link to comment
Share on other sites

Another way to do simple actions is to make an alias command

 

e.g.

 

alias seek='cd ~/somedir;grep -ri 'payroll' payroll.txt

 

when you type seek, it will do each command.

 

To make this permanent, you need to add it to a startup script, your .bashrc or /etc/profile file. I have a whole bunch of alias commands that I use. Want to go to my winSoftware partition? alias software='cd /mnt/software;clear;ll'

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...