echo -e '(b) \033[3;32m for between hours\033[m';
echo -e ' please choose \033[32;5m (a or b)\033[m';
read option
#if [ "$option" == "a" ]
#then
destination="/home/siva/test"
echo -e 'date in format: \033[33;5m(mm-dd-yy) eg.10-30-22\033[m ' # date format of thread_dumps needed
read -p "enter date : " D #enter the date of thread_dumps needed
echo -e 'hour in format: \033[33;5m( HH )\033[m'
read -p "enter Time (HH:MM) : " T #enter specific hour of thread_dumps needed
H= echo $T | awk '{print substr($1,1,2)}'
find=`find /home/siva/thread_dumps/thread_dump_"$D"_"$H"\:[0-9][0-9]\:0[1-2]`
echo $find
#cp $find $destination
# zip -r /home/siva/zip/thread_dumps_"$D".zip $find
In the above script
I want to assign the variable (H= echo $T | awk '{print substr($1,1,2)}). And I want to use the variable in the same script. But this doesn't work for me. I want echo output in a variable and use it in find command
H.findcommand. You appear to want to use a globbing pattern (which includes the two variables$Dand$H) to match a number of directories under/home/siva/thread_dumps, is this correct? Also, if you want the hour in "HH" format, why do you ask for the time in "HH:MM" format?$Hto. Should it have the stringecho $T | awk '{print substr($1,1,2)}'or should it have the result of running the commandecho $T | awk '{print substr($1,1,2)}'? Also note you cannot have spaces around the=in variable assignments.