I'm trying to find a way to return a value to shell without it executing. is there a special character that will encase a sting including the command to a shell without executing, so waiting for the user to press enter.
say i wanted to return a value like "cd /usr/mydocs/mywrk/thedate/" but just have it sit in the shell.
anyway is this possible or am i waisting my time here
command=`echo "date"`
echo "Do you want to execute the command '${command}:'"
read RET
if [[ ${RET} = "" ]]
then
exec ${command}
else
printf "\n\n The command '${command}' is not being run. \n\n"
fi
Sample Output:
$ ./test1
Do you want to execute the command 'date:' ## Hit return (ENTER) without inputting anything.
Fri Feb 6 01:16:36 CST 2009
$ ./test1
Do you want to execute the command 'date:'
Y ## ## Input Y (or anything for that matter) and the else part of the if condition is executed.
The command 'date' is not being run.
$