Skip to content
Advertisement

ksh/bash run command line from variable

I set in cmd variable the find syntax: , I use ksh shell/bash

JavaScript

so why when I want to run the cmd as the following I not actually activate the find …

JavaScript

it’s also not works when I run with double brackets

JavaScript

what is the resolution for this?

Remark I not want to set the cmd like this ( this is works )

JavaScript

or

JavaScript

Advertisement

Answer

Store your command string in the variable:

JavaScript

Then, evaluate the variable contents:

JavaScript

UPDATE: the safer option, according to alvits and Gordon:

JavaScript
Advertisement