Search Results

Search: Posts Made By: curlee2002
27,557
Posted By curlee2002
[SOLVED] Bash: if condition as variable
Thank You, Franklin52.

Adding eval after the if did the trick. I added it on line 28 of the test script below.

my final test script

#!/bin/bash
#test.sh

fileType=( avi flv iso mkv mp4...
27,557
Posted By curlee2002
[SOLVED] Bash: if condition as variable
How can I use a variable that has the conditions for the if statement stored in it?

my test script

condition="[ a = b ] || [ a = a ] || [ c = a ]"

if "$condition"
then echo "true"
...
Showing results 1 to 2 of 2

 
All times are GMT -4. The time now is 08:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy