Does anyone know why the following script doesn't work?
Code:
#!/bin/bash
cmda='hd "The Simpsons.(19x15).avi"|head'
$cmda
cmdb="hd 'The Simpsons.(19x15).avi'|head"
$cmdb
cmdc='hd The\ Simpsons.\(19x15\).avi|head'
$cmdc
When I run it I get
Code:
hd: "The: No such file or directory
hd: Simpsons.(19x15).avi"|head: No such file or directory
hd: 'The: No such file or directory
hd: Simpsons.(19x15).avi'|head: No such file or directory
hd: The\: Invalid argument
hd: Simpsons.\(19x15\).avi|head: Invalid argument
The strange thing is that those commands are perfectly fine if I copy the text variable out and run it...
The reason for my question above is because I have a script that generates a command dynamically and puts that command in a variable for execution.
Thanks.