mirror of
https://github.com/autistic-symposium/shell-whiz-toolkit.git
synced 2025-08-24 13:19:36 -04:00
some sytem scripts
This commit is contained in:
parent
4b0a965e4a
commit
5852171b21
25 changed files with 639 additions and 1 deletions
|
@ -50,4 +50,48 @@ Useful Cmds:
|
|||
List size of folders
|
||||
$ du -sh *
|
||||
|
||||
Print calendar:
|
||||
$ cal
|
||||
|
||||
Writing and creating a file:
|
||||
$ cat > NEWFILE
|
||||
|
||||
--- write here ---
|
||||
^D
|
||||
|
||||
|
||||
De-bug Shell Script
|
||||
-------------------
|
||||
|
||||
Use -v and -x option:
|
||||
$ sh option SCRIPT
|
||||
$ bash option SCRIPT
|
||||
|
||||
|
||||
Local and Global Variables
|
||||
-------------------------
|
||||
|
||||
Whenever you type:
|
||||
$ /bin/bash
|
||||
You start a new shell where the previous variables will be forgotten (local variables). To make variables global, you can do:
|
||||
$ export VARIABLE-NAME
|
||||
Before changing shell.
|
||||
|
||||
|
||||
Conditional Execution
|
||||
---------------------
|
||||
|
||||
The control operators are && (AND) and || (OR).
|
||||
$ rm myf && echo "File is removed successfully" || echo "File is not removed"
|
||||
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
$ SayHello()
|
||||
{
|
||||
echo "Hello $LOGNAME, Have nice computing"
|
||||
return
|
||||
}
|
||||
To execute this SayHello() function just type it name as follows:
|
||||
$ SayHello
|
Loading…
Add table
Add a link
Reference in a new issue