-
at command - Run a shell script or command at a specific time in linux terminal In this article we can learn how to run a command at specific time in linux. Run and execute a command or shell script in specific given time in linux terminal. Execute a command at specific time: 1 echo "/usr/bin/notify-send hello" | at …
Read More -
Array - Get element values at specific starting position in linux bash shell In this article we can learn how to output the elements in specific starting position in linux bash shell. 1e.g: starting at second element 2 arrayNames=( btc eos eth usdt ltc) 3 echo ${arrayNames[@]:1} 1e.g: starting at fourth element 2 …
Read More -
Array - Remove elements from a linux shell array In this article we can learn how to delete/remove elements/indexes from an linux bash shell array. The following way can remove an array element completely: 1 arr=(eth eos btc usd etc) 2 delete=2 3 arr=( "${arr[@]:0:$delete}" "${arr[@]:$(($delete+1))}" ) 4 echo …
Read More -
Array - Replace elements or replace matched words in linux shell array In this article we can learn how to replace elements,words,characters in linux bash shell arrays. usage: echo ${array[@]//substring/replacedstring} example1) Remove 'ltc' then replace 'bch': 1e.g: 2 arrayNames=( btc eos eth usdt ltc) 3 echo …
Read More -
Array - Get last element of an array in linux shell In this article we learn about how to get last element of an array in linux shell in linux terminal. We can use negative index: 1 arr=( usdt btc eos ) 2 echo "${arr[-1]}" 1 arr=( usdt btc eos ) 2 echo "${arr[-2]}" Helpful links: …
Read More -
Array - Add new elements to an array using linux terminal In this article we can learn how to add/create new elements in an array push elements to a array without elements index in linux terminal bash. Push elements to a array without elements index On linux shells arr[0]="new" and arr[1]="newest" methods are not …
Read More -
Array - Create an simple array in linux terminal In this article we can learn how to declare/define/create an array in linux commandline terminal. method1) using direct index values: usage: 1 array[value]="element" examples: 1 arrayNames[0]="btc" 2 arrayNames[1]="usdt" 3 arrayNames[2]="eth" 4 echo "${arrayNames[@]}" …
Read More -
Array - Display all elements in a array in linux In this article we can learn how to display each element in a array using for loop in linux terminal 1 arrayNames=( btc usdt eos eth ) 2 for names in "${arrayNames[@]}" 3 do 4 echo "$names" 5 done Display all the elements in an array: 1 arrayNames=( btc usdt eos eth ) 2 …
Read More -
Array - Display elements in a range in linux shell In this article we can learn how to display elements in a specific range in linux terminal shell. Index 2 to 4: 1 arrayNames=( btc eos eth usdt ltc) 2 echo ${arrayNames[@]:2:4} Index 1 to 3: 1 arrayNames=( btc eos eth usdt ltc) 2 echo ${arrayNames[@]:1:3} Helpful …
Read More -
Array - Display length of the specific element in linux shell In this article we can learn how to display character count in a array element in linux bash shell and Display character count in a array element. Character count in 1st element: 1 arrayNames=( btc eos eth usdt ltc) 2 echo ${#arrayNames[1]} Character count …
Read More -
Array - Access each elements in a array using for loop in linux In this article we can learn how to traverse through the array elements we can use for loop in linux 1 arrayNames=( way test auth new ) 2 for names in "${arrayNames[@]}" 3 do 4 echo "array elements : $names" 5 done Helpful Links: …
Read More