keep it simple version:

fileSelect.sh

#!/bin/bash
select FILENAME in *;
do
        echo "You picked $FILENAME ($REPLY), it is now only accessible to you."
        chmod go-rwx "$FILENAME"
        break;
done

bash linux file select output terminal

 

creditz: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_09_06.html

cool grafical but not working-right version:

while this does very beautiful menus… somehow it did not “work” right (did not find any files?)
could not modify default dir… anyway.

fileDelete.sh

bash linux file select output terminal2

#!/bin/bash
# deletefile.sh - Remove the file using dialog box
# -------------------------------------------------
# purpose - remove file
#  $1 - filename
function delete_file(){
	local f="$1"
	local m="$0: file $f failed to delete."
	if [ -f $f ]
	then
		/bin/rm $FILE && m="$0: $f file deleted."
	else
		m="$0: $f is not a file."
	fi
	dialog --title "Remove file" --clear --msgbox "$m" 10 50
}

# select filename using dialog
# store it to $FILE
FILE=$(dialog --title "Delete a file" --stdout --title "Please choose a file to delete" --fselect /script/test/ 14 48)

# delete file
[ ! -z $FILE ] && delete_file "$FILE"

creditz: http://bash.cyberciti.biz/guide/The_file_selection_box

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin