08-30-2009
Shell argument
I need to create a Kash script that will read two arguments. So if the user enters anything but 2 arguments then they will get and error message. If they enter the two arguments then it will print them out in reverse order. Does anyone know how i can do this?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
how to parse the command line argument to look for '@' sign and the following with '.'.
In my shell script one of the argument passed is email address. I want to parse this email address to look for correct format.
rmjoe123@hotmail.com has '@' sign and followed by a '.'
to be more... (1 Reply)
Discussion started by: rmjoe
1 Replies
2. Shell Programming and Scripting
Trying to tar specific files from a directory causes problems when the number of files is too large.
ls ~/logs | wc -l
5928
In the logs directory - I have 5928 files
If I want to include all files with today's date - I run the following command
tar cf ~/archive/LoadLogs_20060302.tar... (8 Replies)
Discussion started by: dad5119
8 Replies
3. Shell Programming and Scripting
All,
I am having a shell script and i will pass different argument diferent time . Please tell me how can i find the last argument that i passsed each time when i exec the script.
Thanks,
Arun. (5 Replies)
Discussion started by: arunkumar_mca
5 Replies
4. UNIX for Dummies Questions & Answers
Hi,
If not running a shell script file in current shell (. ./fileName) then $0 represents the executable file name. But in case of invoking shell script file in current shell then i m getting "$0 as -bash" . In such case how can i get the program name (running shell script file name)?
Thanks, (2 Replies)
Discussion started by: painulyarun
2 Replies
5. Shell Programming and Scripting
Hi All,
I have a script which accepts a parameter which can either be blank, a specific value, or a wildcard value. But it never seems to be blank and the wildcard option seems to return the names of matching files in my directory. This happens even with the worlds simplest script that just... (1 Reply)
Discussion started by: cdines
1 Replies
6. UNIX for Dummies Questions & Answers
#!/bin/bash
echo "enter a file or directory name"
read name
if
then
echo " argument is file "
ls -l $name | awk '{print $1,}'
elif
echo " argument is a directory"
ls -l $name | awk '{print $1}'
fi
what i am trying to do. get input... (3 Replies)
Discussion started by: iluvsushi
3 Replies
7. Shell Programming and Scripting
Hi I am new in shell,
I am trying to create a small script that can do exit if a script is executed when argument not 2
#!/bin/sh
if ; then
echo greater
exit 1;
elif ; then
echo less
exit 1;
fiit keeps returning me
whatever number of argument I... (1 Reply)
Discussion started by: peuceul
1 Replies
8. Shell Programming and Scripting
Hi,
I have a requirement to work on script, it should take either of arguments.
wrote it as below.
#!/bin/bash
usage() {
echo "$0: missing argument OR invalid option !
Usage : $0 -m|-r|-d
}
while getopts mrdvh opt; do
case "$opt" in
m) monitor_flag=monitor;;... (1 Reply)
Discussion started by: ramanaraoeee
1 Replies
9. Shell Programming and Scripting
Hi,
Is there any way that we can pass one file as one of the argument in shell script ? (1 Reply)
Discussion started by: Selva_2507
1 Replies
10. Shell Programming and Scripting
In one of my shell function I found the following
set_default_values () {
prog=$1
PROC_DT=$2
RESET_ALL="${3-N}"
#echo "Processing date as passed = , Program name = "
......
I understand the first and second arguments, but don't understand... (1 Reply)
Discussion started by: digioleg54
1 Replies
LEARN ABOUT HPUX
sccshelp
sccshelp(1) General Commands Manual sccshelp(1)
NAME
sccshelp - ask for help on SCCS commands
SYNOPSIS
[arg]...
DESCRIPTION
The command finds information to explain a message from an SCCS command or to explain the use of a SCCS command. Zero or more arguments
can be supplied. If no arguments are given, prompts for one:
The arguments can be either message numbers (which normally appear in parentheses following messages) or command names, of one of the fol-
lowing types:
Type 1 Begins with nonnumerics, ends in numerics. The nonnumeric prefix is usually an abbreviation for the program or set of
routines which produced the message (e.g., for message 6 from the command).
Type 2 Does not contain numerics (as a command, such as
Type 3 Is all numeric (e.g.,
The response of the program is the explanatory information related to the argument, if there is any.
You can use to support other commands by means of the file. To do this, create help files in the appropriate format and add the location
of the helpfiles to
EXTERNAL INFLUENCES
Environment Variables
determines the interpretation of text as single- and/or multibyte characters.
determines the language in which messages are displayed.
If is not specified or is null, it defaults to the value of If is not specified or is null, it defaults to "C" (see lang(5)). If any
internationalization variable contains an invalid setting, all internationalization variables default to "C". See environ(5).
International Code Set Support
Single- and multibyte character code sets are supported.
DIAGNOSTICS
When all else fails, try
EXAMPLES
If you enter the SCCS command without parameters, you would get the message:
If you request help for the command:
it displays:
If you request help for the error number:
it displays:
WARNINGS
Only SCCS commands currently use
FILES
Directory containing files of message text
List of commands supported by sccshelp
File containing the locations of help files that are not in the
directory
sccshelp(1)