eval - built-in shell command used to evaluate and execute strings as a shell command eval is to interpret and execute dynamic or complex commands stored in strings or variables
syntax $ eval [arguments]
To Store Command in a Variable $ var="free -h" $ eval "$var"
To substitute command $ command="echo $(uptime)" $ eval "$command"
To generate and execute commands inside a loop dynamically $ vim newscript.sh #!/bin/bash for i in {1..10}; do eval "echo 'Loop iteration $i'" done :x save and exit run $ bash newscript.sh
regards, T.Dhanasekar