Reputation: 7
The code:
#!/bin/bash
# YAD GUI to the set of Shell Linux script
frmdata=$(yad --title "Input SRA accession number" --form --field
"SRA ID")
frmaddr=$(echo $frmdata | awk 'BEGIN {FS="|" } { print $1 }')
echo $frmaddr > SRAIds.txt files=$(yad --width 100 --height 100
--title "Choose the action you want to be done" \
--text=" Please enter what to do:" \
--button="Download Files":"./fetch_sra_yad_zenity.sh"
\ # calling the other bash script on the button click
--button="Run alignment" \
--button="Process variant calling" \
--button="Cancel" \
--on-top \
--center \ )
ret=$?
[[ $ret -eq 1 ]] && exit 0
Need to run .sh scripts on relevant button clicks, without disappearing of buttons. How to fix that? Thx.
Upvotes: 0
Views: 3069
Reputation: 11
Your script should look like that:
#!/bin/bash
# YAD GUI to the set of Shell Linux script
frmdata=$(yad --title "Input SRA accession number" /
--form --field "SRA ID")
frmaddr=$(echo $frmdata | awk 'BEGIN {FS="|" } { print $1 }')
echo $frmaddr > SRAIds.txt
files=$(yad --width 100 --height 100 \
--title "Choose the action you want to be done" \
--text="Please enter what to do:" \
--button="Download Files:bash -c ./fetch_sra_yad_zenity.sh" \
--button="Run alignment" \
--button="Process variant calling" \
--button="Cancel" \
--on-top \
--center)
ret=$?
[[ $ret -eq 1 ]] && exit 0
As you can see, I added:
bash -c
to your script and it runs commands. To be more exact that line should look like that:
--button='Download Files:bash - "./fetch_sra_yad_zenity.sh"'
it's because sometimes you may need to run a command with spaces or even some commands - thus they have to be in quotation marks.
Upvotes: 0