ksh script variable problem

March 31, 2009 at 09:09:29
Specs: AIX 6.1
I'm trying to combine two variables with an underscore in between and assign it to a new variable and I don't remember how to do it. Here's the script:

#!/bin/ksh
#Display the date and hostname

DATEFIELD=$(date +%m%d%y)
print -n "Input hostname: "; read HOSTNAME; print ""
print $DATEFIELD
print $HOSTNAME

PATHNAME=$($HOSTNAME && _ && $DATE)
print -n $PATHNAME

exit 0

Any help would be appreciated. Thanks...


See More: ksh script variable problem

Report •


#1
March 31, 2009 at 10:25:13
Is this what you are asking for:

#!/bin/ksh
#Display the date and hostname

DATEFIELD=$(date +%m%d%y)
print -n "Input hostname: "; read HOSTNAME; print ""
print $DATEFIELD
print $HOSTNAME

# double quotes are probably optional
PATHNAME="${HOSTNAME}_${DATEFIELD}"
echo $PATHNAME

exit 0


Report •

#2
March 31, 2009 at 10:40:55
That was it!. Thanks!

Report •

Related Solutions


Ask Question