[CentOS] Maybe OT : strange wildcard behaviour

Tue Oct 26 02:12:30 UTC 2010
cpolish at surewest.net <cpolish at surewest.net>

> If the app supports it (most good GNU like apps do) you need the double dash
> option which will end option processing (ls -l -- -my_stupid_file.foo-)

A script to rename files with unhelpful names:


#! /bin/bash
# Rename files by choosing from a menu C. Polisher 2003/04/21
ls -i
echo -n "Enter inode of file to rename: "
read j
wasname=`find . -maxdepth 1 -inum "${j}" -printf "%p"`
wasname=`echo "${wasname}"|cat -vET`
echo -ne "\nEnter new name for inode ${j}"
echo -n "${wasname}"" : "
read newname
echo -ne "\nrename ${wasname} to ${newname}  (y or n)? "
read yorn
while true
do
	case "${yorn}" in
	Y|y|yes|YES|Yes|yES)
		find . -maxdepth 1 -inum "${j}" -exec mv \{\} "${newname}" \;
		break
		;;
	*)
		break
		;;
	esac
done


-- 
Charles Polisher