06-10-2005
How to check parameter variable?
Hello All,
I have a script that will email out if the email address is specified as parameter 1.
I am using ksh, and then tried the following :
email=$1
Following did not work, I am getting error
test -z $email
test ${email:=" ") -eq " "
test -n $email
test ${?email}
What I am trying to do is, if $1 has a value, then email the report to that email address...
i.e. getreport.ksh
test@gmail.com - will generate report and then email out.
getreport.ksh - will just generate the report
Thanks!
Joseph
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am making a script to check the parameters, but it seems that I can't catch the parameters by loop.
$ cat sendmsg.sh
#!/bin/sh
## Parameter Check
i=0
max=$#
while
do
PARAM=$${i}
i=`expr ${i} + 1`
echo ${PARAM}
done
How can I get the $1, $2, $3 by loop and set their... (2 Replies)
Discussion started by: GCTEII
2 Replies
2. Shell Programming and Scripting
Hi Guys,
I am writing a Unix script which accepts a directory path as parameter $1
so something like
/user5.data/WA/01
will be passed in.
I want to determine if the directory path passed in contains "WA" as above (because then I need to do something specific if it does)
What is the... (9 Replies)
Discussion started by: bcunney
9 Replies
3. Shell Programming and Scripting
HI all,
I have a parameter file with entries like
$$Name =Abhinav
$$CUTOFF_DATE = 11/11/2209
I am reading a variable from this file using a awk command like :
var2=`awk -F"" "/CUTOFF_DATE/{f=$1;}{print f;}" InputFIleName`
but facing an error like
awk: cmd. line:1:... (3 Replies)
Discussion started by: abhinav192
3 Replies
4. UNIX for Advanced & Expert Users
Hi all,
I have four (4) different UNIX flavours and I want to know whether the following commands are correct with respect to wanting to check on what are my current kernel parameter settings.
I just want to clear the doubts hanging over my head whether the commands below are the right ones... (2 Replies)
Discussion started by: newbie_01
2 Replies
5. Shell Programming and Scripting
Hi all
i need to check that if user has passed any input parameter while executing he shell script like
./test1.sh -a"-v"
then do smothing
if user execute the script without giving input paramater then
./test1.sh
then do something
how can we check this input parameter (6 Replies)
Discussion started by: aishsimplesweet
6 Replies
6. Shell Programming and Scripting
Hello again :)
Am currently trying to write a function which will delete a record from a file.
The code currently looks as such:
function deleteRecord() {
clear
read -p "Please enter the ID of the record you wish to remove: " strID
... (2 Replies)
Discussion started by: U_C_Dispatj
2 Replies
7. Shell Programming and Scripting
Hey I'm new in linux,
I'm looking for a code to check whether the parameter is a number or a string.
I have already tried this code:
eerste=$(echo $1 | grep "^*$">aux)
if
But it doesn't work.:confused:
Thanks (2 Replies)
Discussion started by: Eclecticaa
2 Replies
8. Shell Programming and Scripting
Hi,
In my script, there is a variable as below
TME=`date +%H`
I want to take this TME value into another variable called TME_PAR which i can use outside of the current script and this TME_PAR is already present in my home_dir and i wrote below line of code
$home_dir/$TME_PAR=`echo... (1 Reply)
Discussion started by: JSKOBS
1 Replies
9. Shell Programming and Scripting
I have a code which is using to find duplicates in a files based on column.Below is the same code which is used to find duplicates in my file based on column 1
awk -F'|' '{if (x) { x_count++; print $0; if (x_count == 1) { print x } } x = $0}' FileName >Dup_File.txt
But my requirement here is... (3 Replies)
Discussion started by: ginrkf
3 Replies
10. Shell Programming and Scripting
Hi
I am trying to understand a shell scipt file ( .ksh file ) . In the shell script we are referring a variable .
Example : SessLogs=$STAFF_MSTR_DIR/staff_dtls
There are no references in the shell script from where the variable "$STAFF_MSTR_DIR" is being read from .
Could anyone... (2 Replies)
Discussion started by: Sudheer Maddula
2 Replies
LEARN ABOUT DEBIAN
postal-list
postal-list(1) Postal postal-list(1)
NAME
postal-list - program to show how postal expands user names
SYNOPSIS
postal-list user-list-filename conversion-filename
DESCRIPTION
This program shows the expansion that the postal program uses on email addresses. This can be used to make sure that you're configuration
files do what you expect them to, and can also be used to produce a list of user-names for an account creation script (in case you want to
create a million test accounts in a conveniant fashion).
The user-list-filename is the name of a file which contains a list of user's email addresses. This can be just user-names or fully quali-
fied email addresses.
The conversion-filename parameter will be the name of a file containing the conversions to apply to email addresses. Each line in the file
can either be a comment (starting with "#") or is to contain two parameters. The first parameter is the regular expression. For each
email that is to be sent a randomly selected user-name will be checked against all regular expressions, the first match will determine the
translation that is to be applied. The translation will be the second parameter on the line. It will contain a number of "." characters
specifying characters in the name that are not to be translated. To specify the translations a range of characters can be specified inside
square brackets. For example to have every address starting with "a" have a character from "01234567890abc" as it's second character and a
character from "xyz" as it's third character you would have the following: ^a .[0-9abc][xyz]
RETURN CODES
0 No Error
1 Bad Parameters
AUTHOR
This program, it's manual page, and the Debian package were written by Russell Coker <russell@coker.com.au>.
AVAILABILITY
The source is available from http://doc.coker.com.au/projects/postal/ .
See http://etbe.coker.com.au/category/benchmark for further information.
SEE ALSO
postal(8),rabid(8),regex(7)
russell@coker.com.au 0.70 postal-list(1)