What do you want to save?
Add Code snippet
New code examples
-
Shell/Bash 2021-09-10 21:18:02
shell script current time
#!/bin/bash now="$(date)" printf "Current date and time %s\n" "$now" now="$(date +'%d/%m/%Y')" printf "Current date in dd/mm/yyyy format %s\n" "$now" echo "Starting backup at $... Add solution -
Shell/Bash 2021-09-07 01:40:04
rename all files in a folder with progressive numbers linux
for i in *.txt; do new=$(printf "%01d.txt" "$a") mv -i -- "$i" "$new" let a=a+1 done # "%01d.txt" 01 is the number of digits you want your name to be composed of, # Example: %01.txt --> 1.txt , 2.tx... Add solution -
Shell/Bash 2021-09-06 19:22:03
how to get mcp23017 input in binary shell
# assuming chip is addressed to 0x20 # to setup sudo i2cset -y 1 0x20 0x00 0x00 # replace 1 with zero on rev1 pi # iodira is 0x00 and iodirb is 0x01 # setting all pins on gpa to input # echo as binary address GPIOA is 0x12 and GPIOB is 0... Add solution -
Shell/Bash 2021-08-30 11:13:02
bash display items in array
$ printf '%s\n' "${my_array[@]}" Add solution -
Shell/Bash 2021-08-30 05:24:02
awk round numbers up
# Basic syntax: awk 'BEGIN {printf "%.0f\n", $field_to_round}' input_file # Where: - %.0f specifies that the field_to_round will have a precision # of 0 digits (i.e. it will be rounded to an integer). # Example usage: awk 'BEGIN {printf &quo... Add solution -
Shell/Bash 2021-08-30 02:33:01
how to assign values from a loop in bash to a single variabel
results=() for time in ${seconds_list}; do results+=($(bc -l <<< "scale=2; ($cur_time-$time)/3600")) done # print the results: printf "%s\n" "${results[@]}" Add solution
Best helpers
Jean Luis
+5
Terry3497
+5
Aown Ali
+5
Ishan Yadav
+5
SunnyHills
+5
Rocky DeHart
+5
Numeri
+5
Martinako
+5
Eve noonan
+5
Cynthia
+5