#!/bin/sh
for file in *
do
echo $file # instead of the full file name, i want the extension
only
done
how to display $file extension only?
thanks
> for file in *
> do
> echo $file # instead of the full file name, i want the extension
> only
> done
> how to display $file extension only?
echo "${file$##*.}"
Otherwise:
echo "$file" | sed 's/.*\.//'
or:
echo "$file" | awk -F\. '{print $NF}'
--
Chris F.A. Johnson http://cfaj.freeshell.org
===================================================================
My code (if any) in this post is copyright 2001, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
1. DOSEMU boot files: ext .EMU work???
According to the /etc/dosemu.conf file :
# Specify extensions for the CONFIG and AUTOEXEC files. If the below
# are uncommented, the extensions become CONFIG.EMU and AUTOEXEC.EMU.
# NOTE: this feature may affect file naming even after boot time.
# If you use MSDOS 6+, you may want to use a CONFIG.SYS menu instead.
#
#
EmuSys EMU
EmuBat EMU
However, this doesn't seem to work. Suggestions??
--
2. Installing autoconf [was: Installing Sablotron...]
3. rm, mv, others barf on #file.ext#
4. C Structure in Shared Memory question.
7. How do I allow /secure/file.ext, but disallow /cgi-bin/process.cgi/secure/fi
8. Printing problem from Linux to Windoze...HELP PLS!
9. Why does compress produce whatever.ext.Z rather than z/whatever.ext?
10. setting default permission mask for new files on ext[23]?
11. BUG in 0.99 pl 10 with ext file system
12. tar.gz file for Japanese Ext to Linux (0.9.3) 94/1/24 available
13. find a file and output filename without dir spec and ext