I'm stuck with the script which I wrote on Bourne Shell.
Script:
echo "Who are you?"
read Individual
echo "Hello,$Individual"
echo "Where you want to go?"
read Path
grep -c "Path" file.txt
I'm stuck with the script which I wrote on Bourne Shell.
Script:
echo "Who are you?"
read Individual
echo "Hello,$Individual"
echo "Where you want to go?"
read Path
grep -c "Path" file.txt
$ mkdir -p dir{1..3}/dir{1..3}
$ tree dir*
dir1
├── dir1
├── dir2
└── dir3
dir2
├── dir1
├── dir2
└── dir3
dir3
├── dir1
├── dir2
└── dir3
9 directories, 0 files
$ cat deletey.sh
#!/bin/bash
echo "Where you want to go?"
read Path
rm -fr $Path/*
$ ./deletey.sh
Where you want to go?
dir1
$
$ tree dir*
dir1
dir2
├── dir1
├── dir2
└── dir3
dir3
├── dir1
├── dir2
└── dir3
6 directories, 0 files
Rather than use the rm -fr $Path/*
you could opt to use a find
instead:
finds dirs in $PATH
& deletes
find $Path -mindepth 1 -type d -exec rm -fr '{}' +
same as above, runs from inside $PATH
find $Path -mindepth 1 -type d -execdir rm -fr '{}' +