I have a command that i'm exeuting, this command is stored in some variable, while this variable that stores this command stores another variable The thing is when i'm changing my second variable it's not dynamically changed in the my first variable, so the command that is being executed always with the same variable. Here is my code:
test="test"
TEMP_STR="doesn't exist"
checkClient=`p4 client -o -t $test 2>&1`
echo this is the output: "$checkClient"
test="${test}_2"
echo echo this is the new client name "$test"
echo this is the new output: "$checkClient"
This is the output:
this is the output: Client 'test' doesn't exist.
echo this is the new client name test_2
this is the new output: Client 'test' doesn't exist.
Any idea how to solve this ?
echocheckClient=`p4 client -o -t $test 2>&1`you are NOT storing command here but executing command and storing its output.