0

Here is my code.

  #!/bin/bash

  set -- $(cat /home/jeevan/tempzen1.txt)
  zenity "$@"

file tempzen1.txt contains : --list --title FILE-SELECTOR --column serialno. --column file --width 1000 --height 600 --radiolist TRUE "/home/jeevan/very very latest"

Why does not the above code work when the below works? I simply wrote set args inside my script and started zenity from within the same script, then it works, but why not from another text file?

this is my working code:

#!/bin/bash
set -- --list --title "FILE SELECTOR" --column serialno. --column file --width 1000 --height 600 --radiolist TRUE "/home/jeevan/very very latest"
zenity "$@"
0
2

This is exactly the same problem as in your previous question - parameter $@ contains only one argument, namely --list --title "FILE SELECTOR" --column serialno. --column file --width 1000 --height 600 --radiolist TRUE "/home/jeevan/very very latest" (yes the whole part is one argument including spaces, quotes etc.), whereas you want to split it and pass several arguments.

And again solution is to evaluate the command:

set -- "$(cat /home/jeevan/tempzen1.txt)"
eval zenity "$@"

or even better directly:

eval zenity "$(cat /home/jeevan/tempzen1.txt)"
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.