-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodify_examples
executable file
·84 lines (69 loc) · 1.85 KB
/
modify_examples
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
84
#!/bin/sh
# modify_examples - script for testing the modify script
# First, create a directory tree and display it
echo "-----------------------------------"
echo "Creating directory tree for testing"
mkdir "test"
cd "test"
mkdir "dir"
mkdir "directory"
mkdir "folder"
mkdir "dir/inside"
mkdir "dir/inside/deep"
mkdir "dir/another"
mkdir "directory/elephant"
mkdir "directory/giraffe"
ls -R
# Then, use the script in different ways and display results
# showing -h
echo "-----------------------------------"
echo "Running modify -h"
../modify -h
# Correct usage
echo "-----------------------------------"
echo "Correct usage examples:"
echo "Running modify -u directory folder"
../modify -u directory folder
ls -R
echo "-----------------------------------"
echo "Running modify -l DIRECTORY"
../modify -l DIRECTORY
ls -R
echo "-----------------------------------"
echo "Running modify 's/di/SED/' dir FOLDER"
../modify 's/di/SED/' dir FOLDER
ls -R
echo "-----------------------------------"
echo "Running modify -r -u SEDr"
../modify -r -u SEDr
ls -R
echo "-----------------------------------"
echo "Running modify -r -l SEDR"
../modify -r -l SEDR
ls -R
echo "-----------------------------------"
echo "Running modify -r 's/e/EOPSY/' directory"
../modify -r 's/e/EOPSY/' directory
ls -R
#Incorrect usage
echo "-----------------------------------"
echo "Incorrect usage examples:"
echo "Running modify -d"
../modify -d
echo "-----------------------------------"
echo "Running modify -l -u FOLDER"
../modify -l -u FOLDER
ls
echo "-----------------------------------"
echo "Running modify -r 's/[a-z]/1/g'"
../modify -r 's/[a-z]/1/g'
ls
echo "-----------------------------------"
echo "Running modify -u 's/[a-z]/1/g'"
../modify -u 's/[a-z]/1/g'
ls
# After finished, clean up
echo "-----------------------------------"
echo "Cleaning up the test directory tree"
cd ..
rm -r "test"