Tyleo-Dev-ShellScripting-Ol.../SH/lstotextfile.sh

38 lines
750 B
Bash
Raw Permalink Normal View History

2024-02-18 21:29:57 +00:00
#!/usr/bin/env bash
echo "
------------------------
Add ls results to a file
------------------------
You can choose extension and filename
separately.
The file will be stored into a folder
named "LSFILEFOLDER"
"
echo "Choose your filename without extension : "
echo
echo -n "filename="
read fname
echo
echo "Choose your extension : "
echo -n "extension=."
read extf
if [ -f "./LSFILEFOLDER/$fname.$extf" ]
then
echo "File exist"
echo Aborting!
exit
elif [ test ]
then
mkdir ./LSFILEFOLDER &>> /dev/null
touch ./LSFILEFOLDER/$fname.$extf &>> /dev/null
ls ./LSFILEFOLDER/$fname.$extf &>> /dev/null
echo
echo "Now, choose a location of ls command to make a result!"
echo
echo -n "/"
read tree
ls /$tree &>> ./LSFILEFOLDER/$fname.$extf
fi