Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. DIRECTORY="$(dirname "$0")"
  4. DIRECTORY="$(cd "$DIRECTORY" && pwd)"
  5.  
  6. let i=0 # define counting variable
  7. W=() # define working array
  8. while read -r line; do # process file by file
  9. let i=$i+1
  10. W+=($i "$line")
  11. done < <( find $DIRECTORY -type f -name "*.py" )
  12. 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
  13. clear
  14.  
  15. if [ $? -eq 0 ]; then # Exit with OK
  16. CHOSEN_FILE=$(readlink -f $( find $DIRECTORY -type f -name "*.py" | sed -n "`echo "$FILE p" | sed 's/ //'`"))
  17. python "$CHOSEN_FILE"
  18. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement