I am trying to find out how to develop a script that will run a cmd line like .bat in DOS. Were do I learn "how too" Example is I need to change to a specified directory and then execute a cmd line in a shell window. Then I woiuld like to assign a icon to that .bat file so I can just click on it on my desktop. Thanks
man bash <sample> #!/bin/bash cd /directoryname/ command </sample> On Friday 18 June 2004 09:57 am, LeRoy DeVries wrote:
I am trying to find out how to develop a script that will run a cmd line like .bat in DOS. Were do I learn "how too"
Example is I need to change to a specified directory and then execute a cmd line in a shell window. Then I woiuld like to assign a icon to that .bat file so I can just click on it on my desktop.
Thanks
LeRoy DeVries wrote:
I am trying to find out how to develop a script that will run a cmd line like .bat in DOS. Were do I learn "how too"
Example is I need to change to a specified directory and then execute a cmd line in a shell window. Then I woiuld like to assign a icon to that .bat file so I can just click on it on my desktop.
Just like in the DOS world, you can write a list of intructions. The big difference, is that Linux does not require the ".bat" extension. You can call the file whatever you want' within the Linux file name limits. Instead, you make the script file executable, so that it can run. If you use the ls -l command, to show the file permissions, you'll see something like "-rwxrwxrwx" or "-rwxr-----" The permission are 3 sets of 3 bits for read, write and execute. The first set of bits apply to the file owner. The 2nd for a group and the 3rd for everyone else. So in the 1st example, everyone can read write and execute the file. In the 2d, the owner can do all that, but the group can only read the file. No one else has any rights to that file. If you want your script to run, you have to enable the appropriate "x" bits, for whomever you want to be able to run the script. These bits are set with the "chmod" command. man chmod for further info.
LeRoy DeVries wrote:
I am trying to find out how to develop a script that will run a cmd line like .bat in DOS. Were do I learn "how too"
Example is I need to change to a specified directory and then execute a cmd line in a shell window. Then I woiuld like to assign a icon to that .bat file so I can just click on it on my desktop.
Thanks
I highly recommend http://www.linuxcommand.org/ Great tutorial walks you through the whole process. I haven't put anything to use yet - no time - but I've read through the first few sections. Good reading, and easy for even me to understand. Regards, Don -- Don Parris Webmaster Matheteuo Christian Fellowship Charlotte, NC http://matheteuo.org/ webdev@matheteuo.org
LeRoy DeVries wrote:
I am trying to find out how to develop a script that will run a cmd line like .bat in DOS. Were do I learn "how too"
Example is I need to change to a specified directory and then execute a cmd line in a shell window. Then I woiuld like to assign a icon to that .bat file so I can just click on it on my desktop.
Thanks
There are dozens of scripting languages available for Linux although the biggest might be Perl or Python. A fairly simple but powerful scripting language is included in your shell as well, which I'll assume to be Bash. Here's a nice article that might help. http://www.linux.com/article.pl?sid=04/06/11/144245 You could also try to google for bash script howtos. -- Donald Grayson Systems Administrator SportPaint, Inc.
On Friday 18 June 2004 09:20 am, Donald Grayson wrote:
LeRoy DeVries wrote:
I am trying to find out how to develop a script that will run a cmd line like .bat in DOS. Were do I learn "how too"
Example is I need to change to a specified directory and then execute a cmd line in a shell window. Then I woiuld like to assign a icon to that .bat file so I can just click on it on my desktop.
Thanks
There are dozens of scripting languages available for Linux although the biggest might be Perl or Python. A fairly simple but powerful scripting language is included in your shell as well, which I'll assume to be Bash.
Here's a nice article that might help. http://www.linux.com/article.pl?sid=04/06/11/144245
You could also try to google for bash script howtos.
This is very easy to do without a lot of study. You should look in your /usr/bin directory for many shell scripts as examples. Select any one you like and open it with a text editor to see what's inside. For a script like one you describe, it would look like: #! /bin/sh cd /the-directory-you-want command-you-want-to-execute Then save this text file in someplace like /usr/bin and give it a name like MyScript. Then you make an icon by using right-click on your KDE desktop, create new link to application, and fill in the blanks, executing /usr/bin/MyScript. HTH -- Tony Alfrey tonyalfrey@earthlink.net "I'd rather be sailing"
In a previous message, LeRoy DeVries
Example is I need to change to a specified directory and then execute a cmd line in a shell window.
Dead easy - someone's already showed you how to do this. The only thing I'd add is that you create the file in any text editor (e.g. Kate), and that you'll need to ensure that the file is executable (Properties from the right-click menu on the file after creating it). You'll quickly find that the command line is far more powerful in linux than DOS.
Then I woiuld like to assign a icon to that .bat file so I can just click on it on my desktop.
Assuming that you're using KDE (the default desktop in SUSE linux), all you need to do is find the file you've created in Konqueror (the file browser) and drag it onto the desktop. Unfortunately, it's not possible AFAIK to give it a custom icon on the desktop - it will be the default icon for the filetype according to your current theme. HTH John -- John Pettigrew Headstrong Games john@headstrong-games.co.uk Fun : Strategy : Price http://www.headstrong-games.co.uk/ Board games that won't break the bank Valley of the Kings: ransack an ancient Egyptian tomb but beware of mummies!
On Friday 18 June 2004 17:22, John Pettigrew wrote:
Unfortunately, it's not possible AFAIK to give it a custom icon on the desktop - it will be the default icon for the filetype according to your current theme.
To use your own icon, instead of drag/drop from konq, right-click desktop and choose create new -> link to application. Under the "execute" tab point it at your script. Under the "general" tab, click on the icon itself -> choose your icon. The gimp is great for making icons 8)
On Fri, 18 Jun 2004 you said:
On Friday 18 June 2004 17:22, John Pettigrew wrote:
Unfortunately, it's not possible AFAIK to give it a custom icon on the desktop - it will be the default icon for the filetype according to your current theme.
To use your own icon, instead of drag/drop from konq, right-click desktop and choose create new -> link to application. Under the "execute" tab point it at your script. Under the "general" tab, click on the icon itself -> choose your icon. The gimp is great for making icons 8)
Don't forget the 'run in a terminal' checkbox, otherwise you won't see it's output. Also, the script doesn't really have to be executable, OP can run it with '/bin/{ba}sh script' too. Theo -- Theo v. Werkhoven Registered Linux user# 99872 http://counter.li.org Voorhout ICQ: 277217131 ICBM 52 13 27N , 4 29 45E. Jabber: gurp@nedlinux.nl Voor GNUpg/pgp zie headers. MSN: twe-msn@ferrets4me.xs4all.nl
participants (9)
-
Brad Bourn
-
Don Parris
-
Donald Grayson
-
Jake
-
James Knott
-
John Pettigrew
-
LeRoy DeVries
-
Theo v. Werkhoven
-
Tony Alfrey