Bash Script Question
Linda
haniganwork at earthlink.net
Tue Sep 28 16:59:43 UTC 2010
It has been 20 years since I did shell scripting. I was wondering if
anyone could help me out so I didn't have to find my old reference manuals.
I have the following bash shell script
#!/bin/bash
# print.sh
# print files from the right-click context menu in Nautilus
#place this script in ~/.gnome2/nautilus-scripts
# uses the default print
echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | while
read file
do
lpr "$file"
done
exit
I would like to change it so it only prints pdf, ps and txt files will
this work.
echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | while
read file
case "$file" in
'*.pdf ' | ''*.PDF')
'*.ps ' | ''*.PS')
'*.txt ' | ''*.TXT') lpr "$file"
;;
esac
exit
Would this work so no one tries to print an open office file or other
such thing with the script?
I'm sure there is a prettier way to do it.
Linda
More information about the ubuntu-users
mailing list