#!/bin/bash
#command line arg processing
#find last command line value [
echo "-1 value ${@: -1}"
echo "0th value ${BASH_ARGV[0]}"
echo "last index value ${@: $#}"
echo "final process value ${!#}"
for value in $@; do :; done
echo "after loop $value"
#]
#wildcards
#read the input, search that file from the directory
echo "enter the user name"
read user
echo "user $user"
#list files for user
for file in `ls /home/$user`
do
echo "$file"
done
#list file extension .sh
for file in `ls /home/$user/Training/Shell*/*.sh`
do
echo "$file"
done
#list file that has 3 char file name size
for file in `ls /home/$user/Training/Shell*/fo?`
do
echo "$file"
done
#list files those start with [lfh]
for file in `ls /home/$user/Training/Shell*/[lfh]*`
do
echo "$file"
done
#list files that matches the list
echo -e "\n a-z \r\n"
for file in `ls /home/$user/Training/Shell*/[a-z]*`
do
echo "$file"
done
#arguments
echo "arguments $*"
#command line arg processing
#find last command line value [
echo "-1 value ${@: -1}"
echo "0th value ${BASH_ARGV[0]}"
echo "last index value ${@: $#}"
echo "final process value ${!#}"
for value in $@; do :; done
echo "after loop $value"
#]
#wildcards
#read the input, search that file from the directory
echo "enter the user name"
read user
echo "user $user"
#list files for user
for file in `ls /home/$user`
do
echo "$file"
done
#list file extension .sh
for file in `ls /home/$user/Training/Shell*/*.sh`
do
echo "$file"
done
#list file that has 3 char file name size
for file in `ls /home/$user/Training/Shell*/fo?`
do
echo "$file"
done
#list files those start with [lfh]
for file in `ls /home/$user/Training/Shell*/[lfh]*`
do
echo "$file"
done
#list files that matches the list
echo -e "\n a-z \r\n"
for file in `ls /home/$user/Training/Shell*/[a-z]*`
do
echo "$file"
done
#arguments
echo "arguments $*"
No comments:
Post a Comment