Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
X=' "xyz@hotmail.com" "N" "DEVL" "SCOTT" "Western" "Elementary" "West Haven Elementary" "First Grade"'
emailid="$(print $X|cut -f1 -d\ | cut -f2 -d\" |cut -f1 -d\" )"
send_mail="$(print $X|cut -f2 -d\ | cut -f2 -d\" |cut -f1 -d\" )"
sid="$(print $X|cut -f3 -d\ | cut -f2 -d\" |cut -f1 -d\" )"
user="$(print $X|cut -f4 -d\ | cut -f2 -d\" |cut -f1 -d\" )"
region="$(print $X|cut -f5 -d\ | cut -f2 -d\" |cut -f1 -d\" )"
typ="$(print $X|cut -f6 -d\ | cut -f2 -d\" |cut -f1 -d\" )"
org="$(print $X|cut -f7 -d\ | cut -f2 -d\" |cut -f1 -d\" )"
asgn="$(print $X|cut -f8 -d\ | cut -f2 -d\" |cut -f1 -d\" )"echo $org
returns West
echo $asgn
return Haven
I need to org to return West Haven Elementary and asgn to return First GradeTIA
Covina

A shell subroutine would process the passed parameters properly.
# !/bin/bashassign_vars() {
emailid=$1
send_mail=$2
sid=$3
user=$4
region=$5
typ=$6
org=$7
asgn=$8
}X='"xyz@hotmail.com" "N" "DEVL" "SCOTT" "Western" "Elementary" "West Haven Elementary" "First Grade"'
eval assign_vars $X
echo "emailid=$emailid"
echo "send_mail=$send_mail"
echo "sid=$sid"
echo "user=$user"
echo "region=$region"
echo "typ=$typ"
echo "org=$org"
echo "asgn=$asgn"
./myscript.sh
emailid=xyz@hotmail.com
send_mail=N
sid=DEVL
user=SCOTT
region=Western
typ=Elementary
org=West Haven Elementary
asgn=First Grade

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |