Posts

grep multiple strings

bash-3.2$ grep 'pujapr\|jayag\|mohanbn\|mshakti' src/gem/raw/passwd pujapr:$1$vP4gxDwy$hdNlWdCYkvprTXiv6UJUi/:51692:100:Puja Priya:/home/pujapr:/bin/bash jayag:$1$VcnkwPKx$noVX0HZBiUT1HPv7./gup.:56408:100:Jayaprada Gunturi:/home/jayag:/bin/bash mshakti:$1$IJL3IVaE$Cbeeef8v61BB5QzYfXkIN/:58885:100:Sakthi Murugan Subramani:/home/mshakti:/bin/bash mohanbn:$1$5qWwhwXu$5Ptf5w3IBW35fuXAbk4H60:25807:100:Mohan Babu N:/home/mohanbn:/bin/bash

mount clntudp_create: RPC: Program not registered

[root@lobbynet-38 ~]# showmount -e 172.16.188.10 mount clntudp_create: RPC: Program not registered just restart the nfs service again [root@lobbynet-38 ~]# /etc/init.d/nfs restart Shutting down NFS mountd: [FAILED] Shutting down NFS daemon: [FAILED] Shutting down NFS quotas: [FAILED] Shutting down NFS services: [ OK ] Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS daemon: [ OK ] Starting NFS mountd: [ OK ]

Script: Count how many positional paramers Given

#!/bin/bash echo $# ---> This will calculate the number of arugents given at command prompt seq $1 $2 --> $1 will be first argument & $2 will be second argument [root@noisecover-dr Scripts]# ./pospar.sh 2 7 9 10 --> I have given 4 arguments 4 --> total number of arguments 2 3 4 5 6 7

declare arrays1

See all the arrays at same time [root@test1 ~]# echo "${PROD[*]} " items motels teen [root@test1 ~]# printf "%s\n" "${PROD[*]} " items motels teen

declare arrays

[root@test1 ~]# declare -a PROD[0]="items" PROD[1]="motels" PROD[2]="teen" [root@test1 ~]# echo "${PROD[1]} " motels [root@test1 ~]# echo "${PROD[2]} " teen [root@test1 ~]# echo "${PROD[1]} " motels [root@test1 ~]# echo "${PROD[0]} " items [root@test1 ~]# echo $PROD --> by default showing array[0] items

declare readonly variable

declare -r name=davinder echo $name davinder name=davi -bash: declare: name: readonly variable now i am unable to revert it back....

declare examples & clarifications

[root@test1 ~]# declare -i number=15 --declare the integer value 15 ...i means integer [root@test1 ~]# echo $number 15 [root@test1 ~]# printf "%d\n" "$number" 15 [root@test1 ~]# declare -i number="davinder" [root@test1 ~]# echo $number ---> "davinder" is not the integer 0 [root@test1 ~]# printf "%d\n" "$number" 0 [root@test1 ~]# printf "%s\n" "$number" 0 [root@test1 ~]# declare number="davinder" [root@test1 ~]# printf "%s\n" "$number" 0 [root@test1 ~]# echo $number 0 [root@test1 ~]# declare -p number --> show the number variable status declare -i number="0" [root@test1 ~]# declare +i number -->+i reverse the integer [root@test1 ~]# echo $number 0 [root@test1 ~]# echo $number 0 [root@test1 ~]# declare -p number declare -- number="0" [root@test1 ~]# printf "%s\n" "$number" 0 [root@test1 ~]# declare -i number="davinder...