gestion des chemins complets
This commit is contained in:
12
script.sh
12
script.sh
@@ -2,16 +2,18 @@
|
||||
|
||||
set -eu
|
||||
# la redéfinition de l'IFS permet de gérer correctement les fichiers avec des espaces dans le nom
|
||||
IFS=$'\n\t'
|
||||
|
||||
# /foo/bar sera renommé en /Foo/bar
|
||||
# /foo/bar sera renommé en /Foo/bar
|
||||
# Pour bien faire il faudrait séparer le chemin du nom du fichier
|
||||
if [ $# -lt 1 ] ; then
|
||||
echo "gimme at least one file"
|
||||
exit 1
|
||||
fi
|
||||
# file = Test/fichier1
|
||||
|
||||
for i in "$@" ; do
|
||||
test -f "$i" || continue
|
||||
mv $i ${i^}
|
||||
for file in "$@" ; do
|
||||
dn=$(dirname $file)
|
||||
bn=$(basename $file)
|
||||
test -f "$file" || continue
|
||||
echo mv $file ${dn}/${bn^}
|
||||
done
|
||||
0
test/fichier 6
Normal file
0
test/fichier 6
Normal file
0
test/fichier1
Normal file
0
test/fichier1
Normal file
0
test/fichier2
Normal file
0
test/fichier2
Normal file
0
test/fichier3
Normal file
0
test/fichier3
Normal file
0
test/fichier4
Normal file
0
test/fichier4
Normal file
0
test/fichier5
Normal file
0
test/fichier5
Normal file
Reference in New Issue
Block a user