creating scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting creating scripts
# 1  
Old 02-08-2009
Error creating scripts

Hello...

First of all, as a new member, i found this forum very helpful and all the members have great knowledge.

I am trying to learn unix online, as i have to make a script to monitor a solaris machine performance.

I found UNIX not as hard as i thought but making scripts and printing it into reports is something not easy at all.

If Any one could help you will save my job Smilie
# 2  
Old 02-08-2009
Thanks for the kind words.

FYI: You need to have a specific question if you want forum members to efficiently help you.

If you are just getting started and have no idea what to ask, you might consider the published books and articles on scripting by our active forum members.
# 3  
Old 02-08-2009
thx for your info,

I need to know specific step by step how to create a script as several steps are wrong when i tried to use some code from the internet.
I need also to know how to save the script into a file and making a report

do you think this is specific or should i specify more?
# 4  
Old 02-08-2009
Quote:
Originally Posted by mohamedh_14
thx for your info,

I need to know specific step by step how to create a script as several steps are wrong when i tried to use some code from the internet.
I need also to know how to save the script into a file and making a report

First create a directory to hold your scripts:
Code:
mkdir -p $HOME/bin

Add this directory to your PATH variable if it is not already there:

Code:
case :$PATH: in
     *:$HOME/bin:*) ;;
     *) PATH=${PATH%:}:$HOME/bin ;;
esac

Choose a text editor.
Use whichever editor you fell most comfortable with. Any UNIX system will have several to choose from. My preference is emacs, but if you haven't used a text editor before, you might be better off with pico or nano.
Invoke the editor with the name of your script file, e.g.:
Code:
nano $HOME/bin/myscript

Write your script. For example:
Code:
echo "Hello, World!"

Save the file.

Exit the editor.

Give the file execute permissions with:
Code:
chmod +x $HOME/bin/myscript

Execute the script ($ is your cxommand prompt; Hello, World! is the output of the script).:
Code:
$ myscript
Hello, World!

For further information, visit some of the links listed on my web page, Links to other shell resources.
# 5  
Old 02-08-2009
Quote:
Originally Posted by cfajohnson
For further information, visit some of the links listed on my web page, Links to other shell resources.
I think we should create a new category in our links directory and transfer those excellent resources there.
# 6  
Old 02-08-2009
thx alot for your useful information Smilie
it's useful steps
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Creating a .profile, displaying system variables, and creating an alias

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Here is what I am supposed to do, word for word from my assignment page: 1. Create/modify and print a... (2 Replies)
Discussion started by: Jagst3r21
2 Replies

2. Shell Programming and Scripting

Help with creating startup scripts using screen

Edit: So sorry! I really didn't do a good job of clearly stating what I needed. Going to completely rewrite my post so everything is clearly stated. I'm having trouble writing a shell startup script for a linux server. It uses the bash shell if I remember correctly. I'm trying to write it so... (9 Replies)
Discussion started by: Pyitoechito
9 Replies

3. Shell Programming and Scripting

creating directory from scripts

Dear All, I have a shell scripts which create a directory and perform moving some files, when the script is kept where it is creating directory then it runs fine , but when the scripts is run where it is supposed to be which is different location then where i am creating directory , scripts... (2 Replies)
Discussion started by: guddu_12
2 Replies

4. UNIX Desktop Questions & Answers

creating an executable file from shell scripts

Hi Friends, I have a shell script which does some operations etc, would it be possible to create an executable file out from this shell script? meaning the executable file is not editable, thus the source code will not be visible to other users for copyright reasons. Please help, thanks! (1 Reply)
Discussion started by: kokoro
1 Replies

5. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

6. Shell Programming and Scripting

Creating Log files from Scripts

Hi I would like to create a log file to track the execution of my script. Example, if there were any errors, if it passed or failed etc. How do I go about doing this. My log file will be saved to this location: /var/log/import.log How do I specify the directory? I have been... (1 Reply)
Discussion started by: ladyAnne
1 Replies

7. Ubuntu

Problem creating Desktop shortcuts through Debian dpkg installer scripts

Hi, I am creating a debian package (*.deb) for my application using the command I am using debian pre/post installer scripts to do certain tasks before/after installation/uninstallation. One such task is to create a shortcut on the user's desktop to launch my application. I am trying to do this... (0 Replies)
Discussion started by: royalibrahim
0 Replies

8. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

9. Shell Programming and Scripting

Running scripts within scripts from cron

Hi all, I have set up a cron job which calls another shell script shell script which in turn calls a Java process. The cron tab looks so. 0,30 7-18 * * 1-5 /u01/home/weblogic/brp/bin/checkstatus.sh >> /u01/home/weblogic/logs/checkstatus.log The checkstatus.sh scripts looks like this. ... (4 Replies)
Discussion started by: sirbrian
4 Replies

10. Shell Programming and Scripting

help needed with creating challenging bash script with creating directories

Hi, Can someone help me with creating a bash shell script. I need to create a script that gets a positive number n as an argument. The script must create n directories in the current directory with names like map_1, map_2 etcetera. Each directory must be contained within its predecessor. So... (7 Replies)
Discussion started by: I-1
7 Replies
Login or Register to Ask a Question