Hi all, I'm a newbie to the Linux world and I got a couple of shell script questions:
(1) How do combine two variables and make it equal to a third variable? For example, I got a variable $A=FirstName, $B=LastName, and I want to combine the variable into one variable so when you echo the final variable, it looks like "Joe Smith", not "JoeSmith". What is the exact syntax for that? (Im using bash shell script)
(2) Down below is a script that I executed called testfile. When I execute, note the bold face item where there is a space between the numbers 516 and 10757. How can I get rid of the space before and after those two numbers? The string I need to output is a little bit tricky...Im puzzled on this one.
Thanks in advance for your response.
[root@mymachine mikey]# sh testfile
Oct
516
10757
Mycmd1 is next
get "$$ BID=# 516 " RPT132.20051012
get "$$ BID=# 10757 " RPT590.20051012
my script looks like this:
[root@mymachine mikey]# cat testfile
# Set date
curdate=`date +%Y%m%d`
mondate="Oct 12"
#daydate=`date +%d`
#totaldate=$mondate . $daydate
mondate=Oct
daydate=12
#totaldate=$mondate + $daydate
cat filelist.txt | grep -i "Oct 12" | grep -i rpt132 > mike1.txt
cat filelist.txt | grep -i "Oct 12" | grep -i rpt590 > mike2.txt
echo $mondate
#
# Strip the Batch ID from the listing of the file
#rm mike1.txt
#rm mike2.txt
batchid1=`cat mike1.txt | cut -nb 27-36`
echo $batchid1
batchid2=`cat mike2.txt | cut -nb 27-36`
echo $batchid2
echo "Mycmd1 is next"
mycmd1="get \"\$\$ BID=#$batchid1\" RPT132.$curdate"
echo $mycmd1
mycmd2="get \"\$\$ BID=#$batchid2\" RPT590.$curdate"
echo $mycmd2
#
#
[root@mymachine mikey]#