Bash Scripts
Bash
Sed
awk
Useful Scripts
Authorization Token
Bash script to read different tokens from a file and pass them to curl
command to find out the valid token for authorization. To read file line by line in a while
loop you can refer Read file line by line
output
Directory Listing
output
proxy authentication dictionary attk
System Commands
find
locate
netstat
Refs:
netstat
is a command line utility that can be used to list out all the network (socket) connections on a system.
ps
-a
flag stands for all processes
-x
will display all processes even those not associated with the current tty
grep
-n
is to print line number and -r
searches in the directory recursively
empty file
Basic Bash Commands and Constructs
Refs :
- https://www.youtube.com/watch?v=LTuuMtQR1uQ&list=PLBf0hzazHTGMJzHon4YXGscxUvsFpxrZT
- https://www.youtube.com/watch?v=aNQCl_ByM20
Basic Expressions
output
If-else
output
Menu select
output
test
Expressions
We can make use of conditional expressions in the bash scripting. In order to know the available expressions use
test
expression in if-else
Use of for loops
output
for-in-loops
output
output
Functions
Arguments
output
Local Variables
output
Exit codes
output
Read file line by line
Refs:
while read -r line; do COMMAND; done < input.file
The -r
option passed to read command prevents backslash escapes from being interpreted.
Add IFS=
option before read command to prevent leading/trailing whitespace from being trimmed.
while IFS= read -r line; do COMMAND $line; done < input.file