-
Notifications
You must be signed in to change notification settings - Fork 0
/
into.sh
executable file
·51 lines (39 loc) · 971 Bytes
/
into.sh
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
#!/bin/bash
Sexit(){
command -v $1 >/dev/null 2>&1 || { echo "Package not found. Aborting." >&2; exit 1; }
}
Help(){
echo "Should include package name, e.g. into echo"
echo "[While using into]"
echo "-ih: for help"
echo "-to: If you want to change to another package, type: -to packageName"
echo "cls: to clear the terminal screen"
echo "[available operations]: ls, cp, mv, rm, chmod, cat, ps, kill, su, echo,\
cd, pwd"
}
if [ $# -eq 0 ]; then
Help
else
line=$1
Sexit $line
fi
while [[ $# > 0 ]]
do
read -r -p "$line >> " after
set -- $after
if [ "$#" = 0 ] || [ "$1" = "-ih" ]; then
Help
elif [ "$1" = "-to" ]; then
Sexit $2
line="$2"
elif [ "$1" = "cls" ]; then
clear
elif [[ "$1" =~ ^("ls"|"cp"|"mv"|"rm"|"chmod"|"cat"|"ps"|"kill"|"su"|"echo"\
|"cd"|"pwd")$ ]]; then
$after
else
tail=" "$after
echo $line $tail
$line$tail
fi
done