Question regarding ksh script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Question regarding ksh script
# 1  
Old 03-31-2010
Question regarding ksh script

Hi all,

I have came across the following line in a script and was not able to interpret the meaning despite searching in the web for answer, my guess is that it seems like a comment to me stating if 0 then return else exit

============================
: 0 - 999 [ 0 return, >0 exit ]
....
.....
============================

This line appear at the beginning of the script, can some experts enlighten me on this.
# 2  
Old 03-31-2010
It would help to know which shell you are running?

In many shells ":" is a command equivalent to the unix command "true". The command does not actually give a syntax error but I can't see it doing anything useful as posted - bearing in mind that space characters are critical when posting shell script.
The various "====" and "...." etc. you post are syntax errors which makes me wonder what file this all came from. Maybe it is an error messages data file or something?
# 3  
Old 04-02-2010
Hi,

It is running on a Korn Shell. The actual scripting is as follows:

#This is a common script used by other scripts
: 0 - 999 [ 0 return, >0 exit ]

error_msg()
{
echo "this is an error msg"
}
# 4  
Old 04-02-2010
: nop command, return always exit status 0. You can give arguments if you like, end of line do nothing. End of line is parsed like any other command line.
: rm *
: $(date)
: or write some comments even # is better or "normal"
When true and false wasn't builtin command, in older script you can see ex.
while : ; do ...
: is always true
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

KSH Script -- loop and data copy question

I am trying to write a script that will allow me to train others with commands that I run manually by only allowing the exact command before continuing onto the next set of commands. Here is where I come into an issue. I have changed the directories for this post. Software we run creates files... (2 Replies)
Discussion started by: hurtzdonut
2 Replies

2. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

3. Shell Programming and Scripting

import var and function from ksh script to another ksh script

Ih all, i have multiples ksh scripts for crontab's unix jobs they all have same variables declarations and some similar functions i would have a only single script file to declare my variables, like: var1= "aaa" var2= "bbb" var3= "ccc" ... function ab { ...} function bc { ... }... (2 Replies)
Discussion started by: wolfhurt
2 Replies

4. UNIX for Dummies Questions & Answers

ksh question

How can I know if my system has ksh feature? #!/usr/bin/ksh Which command we allow me to see? Please advise! (1 Reply)
Discussion started by: bobo
1 Replies

5. Shell Programming and Scripting

A Question On Recursion In Ksh

Hi Folks, I would just like to know how recursion works in ksh or inside a shell in general. I created the following script, but it works(runs recursively) only for 64 times: ---------------- #! /usr/bin/ksh displaymessage() { echo "displaying count: $cnt " echo "wait for 1 second..."... (1 Reply)
Discussion started by: marlonus999
1 Replies

6. Shell Programming and Scripting

KSH scripting question

Good day, I am trying to write a script that completes an ssh challenge to a specific server and writes output to a log. We have shared ssh keys for the script user. My challenge is a simple hostname check; ssh $host hostname My problem arrises when there is an actual challenge, be it... (3 Replies)
Discussion started by: M-Pacificorp
3 Replies

7. Shell Programming and Scripting

ksh question, loops

i want to add about 60 printers using a ksh script. i am having trouble though, i am reading the input from the hosts file and using the lpadmin command to add like so: lpadmin -p -v /dev/null -m netstandard -o dest= i want printername and ipaddy to come from the hosts file, i am having... (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies

8. Shell Programming and Scripting

Question about KSH line.

Wondering what this line meant, especially the 2>&1 and ${RUN_DIR} parts: ${RUN_DIR}/<filename> 2>&1 Where <filename> is the location and name of a file. (1 Reply)
Discussion started by: CapsuleCorpJX
1 Replies

9. Shell Programming and Scripting

How to ask a question to a user in ksh

Hello, I am writing a script in ksh(for HP Unix)where a user must answer to a question . So I want to know kow to test if the user do not answer , so if he enter "REturn". I don't know how to test "space characters" or "empty characters Thanks for your help (2 Replies)
Discussion started by: steiner
2 Replies

10. Shell Programming and Scripting

Simple ksh question

Hi, Simple question I am sure... I need to put yesterdays date in the name of a filename, ie assign yesterdays date to a variable and then I can use it where I want.. using the format yyyymmdd Any suggestions? (1 Reply)
Discussion started by: frustrated1
1 Replies
Login or Register to Ask a Question