Today I will try to show some tricks in UNIX/Linux shells maybe you do not know:
- use . (dot) to execute command or script in the current instance of the shell, this help much when you try to set some variables or change to directory with long and complicated path
- use - (dash) to go to previous working directory. this do not work in bourne shell
- use ${n..nn} in bash to generate sequence of numbers. Maybe was something similar in korn shell, but I can't remember.
$ printf "%03d " {1..100}
Also you can use seq program (mainly available in Linux)
$ printf "%03d " `seq 1 100`
- use bc to make arithmetic calculations on the fly:
# echo 2^15|bc
32768
- printf is very helpfull when you try to create well formatted output. Just follow the same format as in C
To be continued (maybe)...
Subscribe to:
Post Comments (Atom)
Should I trust AI
Should I trust AI? So far no, sorry. I tested for the moment (May, 2025) most advanced model for programming and ask very simple question:...
-
To build firewall under AIX is sample, but as each host based firewall should be done careful 1. Prerequisites To start firewall in AIX yo...
-
There are some cases when you want to create compressed tar archive but you do not have enough disk space to keep original files and tar arc...
-
4. Its time for some system administrator tasks. Oracle ASM need special mark of disks will work with 4.1. Because of some reason (i don...
No comments:
Post a Comment