Sponsored Content
Top Forums Shell Programming and Scripting Unix Shell Scripting Standards Post 302112206 by 66IISW on Monday 26th of March 2007 04:51:29 PM
Old 03-26-2007
Below are a couple of rules to get you started. Good luck with it...

All scripts will begin with #!/bin/ksh to ensure we get ksh results however script is invoked.

All scripts requiring input parameters will contain code to ensure the user has entered an appropriate number of parameters, else the script will display a proper syntax message explaining correct use of the command.

All scripts which create temporary files will create these files in the /tmp directory with the process id as part of the data set name (i.e. /tmp/$$.somename), and will employ the trap command to cleanup all /tmp files on completion, example here:

trap "rm -f /tmp/$$.* 2>/dev/null; exit 2" 1 2 3 9 15
trap "rm -f /tmp/$$.* 2>/dev/null; exit 0" 0

All scripts requiring SAS code to be generated, will use the << functionality to generate the required SAS code dynamically into a /tmp data set.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix Coding Standards

Hi, I am looking for some coding standards for Unix Shell Scripting. Can anyone help me out in this? Regards, Himanshu (3 Replies)
Discussion started by: himanshu_s
3 Replies

2. UNIX IEEE Std 1003.1-2001 (POSIX.1)

Link to the Open Group (UNIX Standards)

Click HERE to learn about The Single UNIX Specification, Version 3 Or: Here is another link to the UNIX IEEE Standard, an Open Group Technical Standard, Issue 7 Keywords UNIX® is a registered trademark of The Open Group (0 Replies)
Discussion started by: Neo
0 Replies

3. Programming

UNIX version standards

I'm new to UNIX programming. I'm used to starting my program's versions at 1.0, but I look at all the UNIX programs out there and see things like 0.000.1 or 3.3.000 and I'm wondering what these things really mean. Do people just type anything they feel in there? Are things in pre-release... (6 Replies)
Discussion started by: hirni
6 Replies

4. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies

5. Shell Programming and Scripting

Unix shell scripting

Hi, we are writing this fields dynamically retrieved from database and writing into the file. $bmpRec = $bmpRec.'|'.$cust_id; # sp4 $bmpRec = $bmpRec.'|'.$serv_id; # sp5 $bmpRec = $bmpRec.'|'.$site_id; # sp6 $bmpRec = $bmpRec.'|'.$loc_id; # sp7 ... (4 Replies)
Discussion started by: Maruthi Kunnuru
4 Replies

6. Shell Programming and Scripting

Unix Shell Scripting

Hi All, Greetings!! I am trying to write a script that will get me the syslog.log file output of last week... That is ...my cron will run on Monday and will get me the syslog output of previous week , last monday-last sunday. I tried using date formatting and tail..but did not succeed.... (4 Replies)
Discussion started by: premamadhuri
4 Replies

7. UNIX for Advanced & Expert Users

Need your Help on Unix Shell Scripting.........

Hi Friends, 1. Bash Shell Scrpt to take backup at evening 2. I need a bash shell script for killing all processes. (5 Replies)
Discussion started by: vinayraj
5 Replies

8. Shell Programming and Scripting

Secure coding standards for Shell Programming

Hi, Can anyone point me to Secure coding standards for shell programming guides, links etc etc... Thanks and regards, Vamsi K Surampalli. (2 Replies)
Discussion started by: vamsisurampalli
2 Replies

9. UNIX for Dummies Questions & Answers

Unix Shell Scripting( Calling from Unix to PLSQL)

Hello Experts, I have the following questions to be discussed here at this esteemed discussion forum. I have two Excel sheets which contain Unix Commands llike creating directory the structure/ftp/Copy/Zip etc to basically create an environment. I need help in understanding some of... (1 Reply)
Discussion started by: faizsaadq
1 Replies
system(3)						     Library Functions Manual							 system(3)

NAME
system - Executes a shell command LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <stdlib.h> int system( const char *string); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: system(): XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies a valid sh shell command. If string is NULL (0), the system() function tests the accessibility of the sh command interpreter. If string is not NULL, the system() function passes the parameter to the sh command, which interprets string as a command and exe- cutes it. DESCRIPTION
The system() function passes the string parameter to the sh command, which interprets string as a command and executes it. The system() function invokes the fork() function to create a child process that in turn uses the exec function to run sh, which interprets the shell command contained in the string parameter. The current process waits until the shell has completed before returning. RETURN VALUES
If the string parameter is NULL, the system() function returns 0 if it is unable to access the command interpreter or a non-zero value if sh is accessible. If the string parameter is not NULL, upon successful completion by sh, the system() function returns the exit status of the shell process in the form that wait(2) returns. Otherwise, the system() function returns a value of -1 and sets errno to indicate the error. Exit status 127 indicates that the shell could not be executed. Note that the exit status should only be interpreted using the macros described in wait(2) and defined in the sys/wait.h header file. ERRORS
The system() function sets errno to the specified values for the following conditions: The status of the child process created by system() is no longer available. In addition, the system() function may set errno values as described by fork(). RELATED INFORMATION
Functions: exec(2), exit(2), fork(2), wait(2) Commands: sh(1) Standards: standards(5) delim off system(3)
All times are GMT -4. The time now is 09:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy