Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- DIRECTORY="$(dirname "$0")"
- DIRECTORY="$(cd "$DIRECTORY" && pwd)"
- let i=0 # define counting variable
- W=() # define working array
- while read -r line; do # process file by file
- let i=$i+1
- W+=($i "$line")
- done < <( find $DIRECTORY -type f -name "*.py" )
- FILE=$(dialog --title "List file of directory /home" --menu "Choose one" 24 80 17 "${W[@]}" 3>&2 2>&1 1>&3) # show dialog and store output
- clear
- if [ $? -eq 0 ]; then # Exit with OK
- CHOSEN_FILE=$(readlink -f $( find $DIRECTORY -type f -name "*.py" | sed -n "`echo "$FILE p" | sed 's/ //'`"))
- python "$CHOSEN_FILE"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement