linux:shell:exemples_scripts:tree.sh
Linux
Affichage d'une arborescence type 'TREE'
Script :
Tree.sh
#!/bin/sh echo if [ "$1" != "" ] #if parameter exists, use as base folder then cd "$1" fi pwd ls -R | grep ":$" | \ sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' if [ `ls -F -1 | grep "/" | wc -l` = 0 ] # check if no folders then echo " -> no sub-directories" fi echo exit
linux/shell/exemples_scripts/tree.sh.txt · Dernière modification : 2022/11/20 14:16 de zandor