-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSHIFT-COMMAND-SHELL-SCRIPT.txt
More file actions
83 lines (73 loc) · 1.75 KB
/
SHIFT-COMMAND-SHELL-SCRIPT.txt
File metadata and controls
83 lines (73 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
https://www.computerhope.com/unix/bash/shift.htm
#!/bin/bash
# Scan directories for old files (over 365 days) and delete them.
USAGE="Usage: $0 dir1 dir2 dir3 ..."
if [ "$#" == "0" ]; then # If zero arguments were supplied,
echo "Error: no directory names provided."
echo "$USAGE" # display a help message
exit 1 # and return an error.
fi
while (( "$#" )); do # While there are arguments still to be shifted...
while IFS= read -r -d $'\0' file; do
echo "Removing $file..."
rm $file
done < <(find "$1" -type f -atime +365 -print0)
shift
done
echo "Done."
exit 0
=============================================================================================
#!/bin/bash
while [[ $1 ]];do
case $1 in
-f | --file)
FILE=$2
shift
;;
-n | --name)
NAME=$2
shift
;;
-p | --password)
PASS=$2
shift
;;
esac
shift
done
for I in $FILE
do
NAME=$(echo $I|tr ',' '\n')
for J in $NAME
do
echo $J
done
done
rcxdev@rcxdev:/tmp$ bash check.sh --file jenkins,subham,mandal,ram
jenkins
subham
mandal
ram
==============================================================================================
while [ "$1" ]
do
if [ "$1" = "-b" ]; then
ob="$2"
case $ob in
16) basesystem="Hex";;
8) basesystem="Oct";;
2) basesystem="bin";;
*) basesystem="Unknown";;
esac
shift 2
elif [ "$1" = "-n" ]
then
num="$2"
shift 2
else
echo "Program $0 does not recognize option $1"
exit 1
fi
done
output=`echo "obase=$ob;ibase=10; $num;" | bc`
echo "$num Decimal number = $output in $basesystem number system(base=$ob)"