Probably a pretty easy question but how to I have the fsck command run in an open terminal from this script? I can't just pass fsck to YAD because fsck requires possible interaction via terminal.
#!/bin/bash
cd /
choice2=$(yad --title='Drives' --text='Choose Drive Prefix for Possible Defrag' --form --field='Show:CB' '0.Exit!1. SDA!2. SDB!3. SDC!4. SDD!5. SDE!6. SDF!7. SDG!8. SDH' --button="Exit:1" --button="OK:0")
ret=$?
if [[ $ret -eq 1 ]]; then
exit 0
fi
numb666=${choice2:0:2}
if [[ $numb666 = "1." ]]
then
name1="/dev/sda"
elif [[ $numb666 = "2." ]]
then
name1="/dev/sdb"
elif [[ $numb666 = "3." ]]
then
name1="/dev/sdc"
elif [[ $numb666 = "4." ]]
then
name1="/dev/sdd"
elif [[ $numb666 = "5." ]]
then
name1="/dev/sde"
elif [[ $numb666 = "6." ]]
then
name1="/dev/sdf"
elif [[ $numb666 = "7." ]]
then
name1="/dev/sdg"
elif [[ $numb666 = "8." ]]
then
name1="/dev/sdh"
fi
parted $name1 'print'|yad --geometry=900x600 --list --title "Drive Results" --text "Listing Drive Types.." --column "Types" --button="Exit:1" --button="OK:0"
ret=$?
if [[ $ret -eq 1 ]]; then
exit 0
fi
yad --text="Choose a the name of a file to obtain the most recent version:" --button="Exit:1" --button="OK:0"
ret=$?
if [[ $ret -eq 1 ]]; then
exit 0
fi
search555=$(yad --entry --entry-label="Drive to Defrag Enter as sda2" --button="Exit:1" --button="OK:0")
ret=$?
if [[ $ret -eq 1 ]]; then
exit 0
fi
cd /
###########################
fsck "/dev/$search555" -f
###########################
I didn't get it at first but the -y did indeed fix the issue.
Good to hear from ya,
Slavvo67
FIXED
#!/bin/bash
# Just a little GUI to defrag partitions -Slavvo67
# Needs YAD and fsck
# fsck takes a while on USB's so wait a bit longer for those.
cd /
choice2=$(yad --title='Drives' --text='Choose Drive Prefix for Possible Defrag' --form --field='Show:CB' '0. Exit!1. SDA!2. SDB!3. SDC!4. SDD!5. SDE!6. SDF!7. SDG!8. SDH' --button="Exit:1" --button="OK:0")
ret=$?
if [[ $ret -eq 1 ]]; then
exit 0
fi
numb666=${choice2:0:2}
if [[ $numb666 = "1." ]]
then
name1="/dev/sda"
elif [[ $numb666 = "2." ]]
then
name1="/dev/sdb"
elif [[ $numb666 = "3." ]]
then
name1="/dev/sdc"
elif [[ $numb666 = "4." ]]
then
name1="/dev/sdd"
elif [[ $numb666 = "5." ]]
then
name1="/dev/sde"
elif [[ $numb666 = "6." ]]
then
name1="/dev/sdf"
elif [[ $numb666 = "7." ]]
then
name1="/dev/sdg"
elif [[ $numb666 = "8." ]]
then
name1="/dev/sdh"
fi
parted $name1 'print'|yad --geometry=900x600 --list --title "Drive Results" --text "Listing Drive Types.." --column "Types" --button="Exit:1" --button="OK:0"
ret=$?
if [[ $ret -eq 1 ]]; then
exit 0
fi
search555=$(yad --entry --entry-label="Drive to Defrag Enter as sda2" --button="Exit:1" --button="OK:0")
ret=$?
if [[ $ret -eq 1 ]]; then
exit 0
fi
cd /
fsck "/dev/$search555" -fy | yad --geometry=900x600 --list --title "Defragging" --text "/dev/$search555" --column "Working..." --button="Exit:1" --button="OK:0"
I did manage to build YAD for puppy 4.12 and similar but that does not allow the newer features mentioned.... but hardly a reason to not do tarty things with it
And yes...a delight to build... nice coding and easy to hack
slavvo67 wrote:Importantly, the above does not work in some older versions of YAD. I think Quirky Unicorn has an old version that would need updating first.
Thank you for the right-click tip. I didn't think about something so obvious but sure enough, it works. Not quite the same as programming it in from the beginning but it'll certainly do.
yad --file --text="<span color='blue'>To see hidden files, right click and choose 'show hidden files'</span>" --text-align="center" --width="500" --height="400"