Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does Aix have a file type like "*.bat"in dos?

Status
Not open for further replies.

redbub

Technical User
Jun 6, 2001
14
0
0
US
I have to type a bunch of command in the command line every Monday morning. I am wondering if there is a file type like the *.bat file in Dos.
I can type call the command in the *.bat file and then only run this file every morning and it can automatically run each command in it.
Is it the script file? How to use it?
Thanks.
 
Yes, it would be a script that could help you do this.

You could write a script to run each of the commands and schedule it through cron to run every Monday at whatever time you want to run it. The script can be as simple as just running the commands, or you could also add error checking in the script.
 
I only can use the script for recording of everything printed on my screen. I can use it to only record the command. How can I do it?
 
No, you don't use the script command.

You write a shell script using vi. Don't forget to make the file executable. And be sure to test it first!

If you need help writing a shell script, there are a lot of resources out there to help you.
 
Specifically,
you are looking to create a Shell script. If you are using the default AIX shell, you will be writing a Korn Shell script. This is the closest thing to the DOS command interpreter language (Batch Files) that you will find. If you know and like batch files, the world of shell scripting will be a big eye opener. I know it was to me way back in '92 when I first started playing with them.

There are minor differences in syntax between the different shells. Make sure you know which one you are using before you purchase a book. One way to find out what shell you are using, process a 'lsuser' command on yourself. For the field named "shell=" you will see what the shell is. Common shells are as follows:

ksh = Korn shell
csh = C shell
bsh = Bourne shell
bash = Bourne Again shell

If you just see sh, you are using the system default. In all likelihood, it is Korn shell.

Once you know what shell you are using, go to your local bookstore and flip through some books.

Test out your scripts for a few days. Once you know they work pretty well, set up some cron jobs to run them. Laziness can be a virtue if you can prevent yourself from having to type commands in by rote each morning. Go learn something new.

Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top