Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Go to bin directory
- cd /bin
- #Print out bin files
- #ls /bin
- #Storing bin files names on var
- # files="$(ls /bin)"
- #Char parameter
- parameter=$1
- char=${parameter:0:1}
- #Consonants
- consonants=( b, c, d, f, g, h, j, k, l, m, n, p, q, r, s, t, v, w, x, y, z)
- #Storing bin files names into an array
- array=( $(ls .) )
- # echo "${array[10]}"
- # echo $char
- if [ $char ]
- then
- for file in ${array[@]}
- do
- #If filename string is greather than 3
- if [ ${#file} -gt 3 ]
- then
- #If third char is equal to char var
- if [ ${file:2:1} = $char ]
- then
- echo $file
- fi
- fi
- done
- else
- echo "No ha enviado un parametro"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement