REPL calculator in Bash and AWK
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1000 lines
23 KiB

declare -i var=10
var+=
declare -i var=10
var+=5
ech o$var
echo $var
var-=5
var*=5
var/=5
var++
unset var
var=10
echo $((var+=5))
echo $((var-=5))
echo $((var*=5))
echo $((var/=5))
declare -i var=10
c=a+10
echo $c
declare -i c
c=a+10
echo $c
c=$a+10
echo $c
declare -i b
b=5
c=$a+$b
echo $c
declare -i a b c
a=10
b=5
c=$a+$b
echo $c
c=$a-$b
echo $c
c=$a*$b
echo $c
c=$a/$b
echo $c
declare -i a
valor+=1
echo $valor
valor+=1
echo $valor
declare -i a
a+=1
echo $a
a+=1
echo $a
a=$a+1
echo $a
a=$a*5
echo $a
cal
cal 3
cal 2022
cal -m3
cal -m3,4,5
cal -m3 -m4
cal -m4
cat /etc/sysctl.conf
cat /etc/systemd/system.conf
cat /etc/systemd/user.conf
cat /etc/systemd/logind.conf
man logind.conf
tmate
tmate csp2022-15
cd doc/csp/scripts/
l
nano doc/sgl/controle.csv
seq 1 10
seq 1 10 | xargs -i echo '{}'
seq 1 100 | xargs -i echo '{}'
./upterm session current
echo $ADMIN_SOCKET_PATH
ssh aUwH8twOiDyei7u1XTqy:MTAuMjQ0LjAuNzA6MjI=@uptermd.upterm.dev
cd dld/
l
untargz upterm_linux_amd64.tar.gz
l
mv upterm upterm.bin
mkdir upterm
mv * upterm/
l
cd upterm/
mv upterm.bin upterm
l
./upterm --help
./upterm session current
./upterm -- bash
./upterm
./upterm host -- bash
r
csd
cwd
pwd
echo ~
cwd
type -a cwd
echo $'\w@P'
: $'\w';
echo $'\w'
echo '\w'
: '\w'; echo ${_@P}
cd doc
pwd
echo $PWD
pwd
echo $PWD
: '\w'; echo ${_@P}
cwd() { : '\w'; echo ${_@P}; }
cwd
type -a cwd
cd git/
l
cd alien/
l
git clone https://github.com/dylanaraps/neofetch.git
cd neofetch/
l
grep get_ neofetch
grep ^get_ neofetch
neofetch
cat /etc/os-release
sed 's/PRETTY.*"(.*)"/\1/' /etc/os-release
sed -r 's/PRETTY.*"(.*)"/\1/' /etc/os-release
sed -nr 's/PRETTY.*"(.*)"/\1/p' /etc/os-release
sed -nr 's/^PRETTY.*"(.*)"/\1/p' /etc/os-release
. /etc/lsb-release; echo $?
cat /etc/lib/lsb-release; echo $?
uname -s
uname -rms
cd doc/csp/desafios/
l
id -un
echo $USER
printf %s "${HOME/*\/}"
echo $HOME
printf %s "${HOME##/}"
printf %s "${HOME##*/}"
hostname -f
hostname
echo $HOSTNAME
man hostname
cd ../scripts/
chmod +x myfetch
./myfetch
neofetch
./myfetch
cat /etc/os-release
sed -nr 's/^PRETTY.*"(.*)"/\1/p' /etc/os-release
uname -p
uname -rms
kernel_info=($(uname -rms))
kinfo=($(uname -rms))
echo ${kinfo[0]}
echo ${kinfo[1]}
echo ${kinfo[2]}
read kernel kversion karch <<< $(uname -rms)
echo $kernel
echo $kversion
echo $karch
./myfetch
neofetch
cat /sys/devices/virtual/dmi/id/board_vendor
cat /sys/devices/virtual/dmi/id/board_name
cat /sys/devices/virtual/dmi/id/board_vendor
cat /sys/devices/virtual/dmi/id/product_name
cat /tmp/systemd-private-85c7f66d67ee441fb5f1d34c7295effb-
cat /sys/devices/virtual/dmi/id/board_vendor /sys/devices/virtual/dmi/id/product_name /sys/devices/virtual/dmi/id/board_name
echo $(< /sys/devices/virtual/dmi/id/board_vendor /sys/devices/virtual/dmi/id/product_name /sys/devices/virtual/dmi/id/board_name)
echo $(< /sys/devices/virtual/dmi/id/board_vendor)
echo $(< /sys/devices/virtual/dmi/id/product_name)
echo $(< /sys/devices/virtual/dmi/id/board_name)
echo "$(< /sys/devices/virtual/dmi/id/board_vendor) $(< /sys/devices/virtual/dmi/id/product_name) ($(/sys/devices/virtual/dmi/id/board_name))"
echo "$(< /sys/devices/virtual/dmi/id/board_vendor) $(< /sys/devices/virtual/dmi/id/product_name) ($(< /sys/devices/virtual/dmi/id/board_name))"
echo "$(< /sys/devices/virtual/dmi/id/board_vendor) $(< /sys/devices/virtual/dmi/id/product_name) MB: $(< /sys/devices/virtual/dmi/id/board_name)"
echo $(< /sys/devices/virtual/dmi/id/board_vendor) $(< /sys/devices/virtual/dmi/id/product_name) MB: $(< /sys/devices/virtual/dmi/id/board_name)
echo $(< /sys/devices/virtual/dmi/id/board_vendor) \
./myfetch
man cat
./myfetch
neofetch
./myfetch
uptime -p
uptime -s
cat /proc/uptime
date -d"$(: $(< /proc/uptime); printf %s ${_/.*})
date -d"$(: $(< /proc/uptime); printf %s ${_/.*}))
date -d"$(: $(< /proc/uptime); printf %s ${_/.*}))"
date -d"@$(: $(< /proc/uptime); printf %s ${_/.*}))"
date -d"@$(s=$(< /proc/uptime); echo ${s/.*}))"
date -d"@$(s=$(< /proc/uptime); echo ${s/.*})"
date -d"@$(echo $(< /proc/uptime) | cut -d' ' -f2)"
date -d"$(echo $(< /proc/uptime) | cut -d' ' -f2)"
date -d@"$(echo $(< /proc/uptime) | cut -d' ' -f2)"
date -d@"$(echo $(< /proc/uptime) | cut -d' ' -f1)"
uptime -s
date -d"$(uptime -s)" +'%s'
cat /proc/uptime
s=$(cat /proc/uptime); echo ${s/.*}
cat /proc/uptime
s=$(cat /proc/uptime); echo ${s/.*}
date -d"$(uptime -s)" +'%s'
boot=$(date -d"$(uptime -s)" +'%s')
now=$(date +'%s')
echo $((now - boot))
date +'%s'
now=$(date +'%s')
echo $((now - boot))
: "$(cat /proc/uptime)"; echo ${s/.*}
: "$(cat /proc/uptime)"; echo ${_/.*}
: "$(< /proc/uptime)"; echo ${_/.*}
date -d@"$(: "$(< /proc/uptime)"; echo ${_/.*})"
date -d@621755 +'%d %H %M %s'
date -d@621755 +'%d %H %M %S'
uptime -p
date -d@621755 +'%H %M %S'
: "$(< /proc/uptime)"; s=${_/.*}
echo $s
d="$((s / 60 / 60 / 24)) days"
echo $d
d="$((s / 60 / 60 / 24)) day"
d=$((s / 60 / 60 / 24))
echo $d
printf %s $d; ((d > 1)) && echo 's'
printf "$d%s" dia; ((d > 1)) && echo 's'
printf "$d %s" dia; ((d > 1)) && echo 's'
[[ $d ]] && printf "$d %s" dia; ((d > 1)) && echo 's'
(($d)) && { printf "$d %s" dia; ((d > 1)) && echo 's'; }
(($d)) && { printf " %s dia" $d; ((d > 1)) && echo 's'; }
(($d)) && { printf "%d dia" $d; ((d > 1)) && echo 's'; }
d=$((s / 60 / 60 / 24))
(($d)) && { printf "%d dia" $d; ((d > 1)) && echo 's'; }
h=$((s / 60 / 60 % 24))
(($h)) && { printf "%d hora" $h; ((h > 1)) && echo 's'; }
m=$((s / 60 % 60))
(($m)) && { printf "%d hora" $m; ((m > 1)) && echo 's'; }
(($m)) && { printf "%d minuto" $m; ((m > 1)) && echo 's'; }
conv_time() { if (($1)); then printf "%d $2" $1; (($1 > 1)) && echo 's'; fi; }
conv_time $h hora
conv_time $m minuto
conv_time $d dia
type -a conv_time
conv_time $((s / 60 / 60 / 24)) hora
conv_time $((s / 60 / 60 / 24)) dia
conv_time $((s / 60 / 60 % 24)) hora
conv_time $((s / 60 % 60)) minuto
conv_time $((0)) minuto
./myfetch
neofetch
has() { type -p "$1" >/dev/null && manager=$1; }
has dpkg
echo $manager
dpkg-query -f '.\n'
dpkg-query -f '.\n' -W
cat ~/bin/debfetch
dpkg-query -f '.\n' -W | wc -l
debfetch
dpkg-query -f '.\n' -W | wc -l
./myfetch
neofetch
echo $SHELL
echo ${SHELL##*/}
${SHELL##*/} --version
sh
env
echo $BASH_VERSION
echo $BASH_VERSINFO
echo $SHELL
sh
ps -o 'command' $$ | tail -1
./myfetch
sh
./myfetch
neofetch
xrandr --nograb --current
xrandr --nograb --current | sed 's/^[^\s](.* ).*([0-9]+x[0-9]+)/\1 \2/g'
xrandr --nograb --current | sed -E 's/^[^\s](.* ).*([0-9]+x[0-9]+)/\1 \2/g'
xrandr --nograb --current | sed -nE 's/^[^\s](.* ).*([0-9]+x[0-9]+)/\1 \2/gp'
xrandr --nograb --current | sed -nE 's/^[^\s](.* ).*([0-9]+x[0-9]+)/\1 \2/p'
xrandr --nograb --current | sed -nE 's/(^[^\s].* ).*([0-9]+x[0-9]+)/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^(^[^\s].* ).*([0-9]+x[0-9]+)/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([^\s].* ).*([0-9]+x[0-9]+)/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([^\s].* ).*([0-9]+x[0-9]+).*/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([A-Z}.* ).*([0-9]+x[0-9]+).*/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([A-Z].* ).*([0-9]+x[0-9]+).*/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([A-Z0-9-]* ).*([0-9]+x[0-9]+).*/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([A-Z0-9-]*) .*([0-9]+x[0-9]+).*/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([A-Z0-9-]*) .*([0-9]+x[0-9]+)\+.*/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([A-Z0-9-]*) .* ([0-9]+x[0-9]+)\+.*/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([A-Z0-9-]*) .* ([0-9]+x[0-9]+).*/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([A-Z0-9-]+) .* ([0-9]+x[0-9]+).*/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([A-Z0-9-]+).*([0-9]+x[0-9]+).*/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([A-Z0-9-]+).*([0-9]+x[0-9]+)/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([A-Z0-9-]+).*([0-9]+x[0-9]+).*/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([A-Z0-9-]+).* ([0-9]+x[0-9]+).*/\1 \2/p'
xrandr --nograb --current | grep -Po '^([A-Z0-9-]+).*?([0-9]+x[0-9]+)'
xrandr --nograb --current | grep -Po '^([A-Z0-9-]+)|([0-9]+x[0-9]+)'
xrandr --nograb --current | grep -Po '^([A-Z0-9-]+).*?([0-9]+x[0-9]+)'
xrandr --nograb --current | grep -Po '^([A-Z0-9-]+)(?=.*?)([0-9]+x[0-9]+)'
xrandr --nograb --current | grep -Po '^([A-Z0-9-]+)(?!.*?)([0-9]+x[0-9]+)'
xrandr --nograb --current | grep -Po '^(?=[A-Z0-9-]+).*?(?=[0-9]+x[0-9]+)'
xrandr --nograb --current | grep -Po '^(?=[A-Z0-9-]+).*?(?![0-9]+x[0-9]+)'
xrandr --nograb --current | grep -Po '^(?=[A-Z0-9-]+).*?\K[0-9]+x[0-9]+'
xrandr --nograb --current | grep -Po '^(?=[A-Z0-9-]+) ([0-9]+x[0-9]+)'
xrandr --nograb --current | grep -Po '^(?=[A-Z0-9-]+).*?([0-9]+x[0-9]+)'
xrandr --nograb --current | grep -Po -m1 '^(?=[A-Z0-9-]+).*?([0-9]+x[0-9]+)'
xrandr --nograb --current | grep -Po '^(?=[A-Z0-9-]+).*?([0-9]+x[0-9]+)'
xrandr --nograb --current | grep -Po '^[A-Z0-9-]+.*?[0-9]+x[0-9]+'
xrandr --nograb --current | grep 'connected'
xrandr --nograb --current | grep '\bconnected'
screens=$(xrandr --nograb --current | grep '\bconnected')
xrandr --nograb --current | grep '(?=[0-9A-Z-]+) connected'
xrandr --nograb --current | grep '^(?=[0-9A-Z-]+) connected'
xrandr --nograb --current | grep -Po '^(?=[0-9A-Z-]+) connected'
xrandr --nograb --current | grep -P '^(?=[0-9A-Z-]+) connected'
xrandr --nograb --current | grep -P '^[0-9A-Z-]+ connected'
xrandr --nograb --current | grep -P '^[0-9A-Z-]+(?= connected)'
xrandr --nograb --current | grep -Po '^[0-9A-Z-]+(?= connected)'
xrandr --nograb --current | sed 's/^[0-9A-Z-]+ connected'
xrandr --nograb --current | sed 's/^([0-9A-Z-]+) connected .* ([0-9]+x[0-9]+)/\1 \2/'
xrandr --nograb --current | sed -E 's/^([0-9A-Z-]+) connected .* ([0-9]+x[0-9]+)/\1 \2/'
xrandr --nograb --current | sed -nE 's/^([0-9A-Z-]+) connected .* ([0-9]+x[0-9]+)/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([0-9A-Z-]+) connected .* ([0-9]+x[0-9]+).*/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([0-9A-Z-]+) connected .*([0-9]+x[0-9]+).*/\1 \2/p'
xrandr --nograb --current | sed -nE 's/^([0-9A-Z-]+) connected.* ([0-9]+x[0-9]+).*/\1 \2/p'
./myfetch
neofetch
xprop -root
xprop -root -notype _NET_SUPPORTING_WM_CHECK
: "$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)"
xprop -id ${_##* }
xprop -id ${_##* } -notype -len 100 -f _NET_WM_NAME 8t
: "$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)"
xprop -id ${_##* } -notype -len 100 -f _NET_WM_NAME 8t
: "$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)"
xprop -id ${_##* }
xprop -id $(xprop -root -notype | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}') -notype -f _NET_WM_NAME 8t
./myfetch
neofetch
command -v xprop
command -v banana
env
env | grep GTK
cat ~/.gtkrc-2.0
cat ~/.config/gtk-3.0/settings.ini
neofetch
grep -Po '^gtk-theme-name=\K.*' <<< $(< $HOME/.config/gtk-3.0/settings.ini)
$(grep -Po '^gtk-icon-theme-name=\K.*' <<< $(< $HOME/.config/gtk-3.0/settings.ini))
grep -Po '^gtk-icon-theme-name=\K.*' <<< $(< $HOME/.config/gtk-3.0/settings.ini)
./myfetch
neofetch
realpath /proc/$PPID/exe
ls /proc/$PPID/exe
cat /proc/$PPID/exe
realpath /proc/$PPID/exe
man realpath
ls -l /proc/$PPID/exe
realpath --version
realpath /proc/$PPID/exe
man grep
ls -l /proc/${$PPID}/status
ls -l /proc/${PPID}/status
cat /proc/${PPID}/status
./myfetch
neofetch
cat ~/.config/xfce4/terminal/terminalrc
grep -i fontname ~/.config/xfce4/terminal/terminalrc
grep -Poi 'fontname=\K.*' ~/.config/xfce4/terminal/terminalrc
./myfetch
cat /proc/cpuinfo
grep 'model name|cpu core' /proc/cpuinfo
grep '(model name)|(cpu cores)' /proc/cpuinfo
grep -E '(model name)|(cpu cores)' /proc/cpuinfo
grep -E '(model name)|(cpu cores)' /proc/cpuinfo | uniq
grep -E 'model name.*: \K.*'
grep -E 'model name.*: \K.*' /proc/cpuinfo
grep -Po 'model name.*: \K.*' /proc/cpuinfo
grep -Po 'model name.*: \K.*' /proc/cpuinfo | uniq
grep -Po 'cpu cores.*: \K.*' /proc/cpuinfo | uniq
./myfetch
lspci -mm
lspci -mm | grep -i 'display|vga|3d'
lspci -mm | grep -i '"display|"vga|"3d'
lspci -mm | grep -Ei '"display|"vga|"3d'
neofetch
lspci -mm
lspci -mm | grep -Ei 'intel hd'
lspci -mm | grep -E 'intel hd'
lspci -mm | grep -Ei 'intel hd'
lspci -mm | grep -Ei 'intel|hd'
lspci
lspci -k
lspci -k | grep -i vga
glxinfo | grep OpenGL
lspci | grep -Ei 'vga|3d|display'
lspci | grep -Ei 'vga|3d|display \KIntel .* Gen(?=.*)'
lspci | grep -Eoi 'vga|3d|display \KIntel .* Gen(?=.*)'
lspci | grep -Eoi '.*vga|3d|display \KIntel .* Gen(?=.*)'
lspci | grep -Poi '.*vga|3d|display \KIntel .* Gen(?=.*)'
lspci | grep -Poi 'vga|3d|display \KIntel .* Gen(?=.*)'
lspci | grep -Poi 'vga|3d|display \KIntel.*Gen(?=.*)'
lspci | grep -Poi '(vga|3d|display).*\KIntel.*Gen(?=.*)'
./myfetch
neofetch
cat /proc/meminfo
neofetch
./myfetch
neofetch
./myfetch
xclip ../desafios/desafio-03.md
xclip myfetch
./myfetch
cd git/alien/neofetch/
grep ^get_os neofetch
ed neofetch
ls -l /proc/$$/fd > arquivo 2>&1
car arquivo
cat arquivo
ls -l /proc/self/fd > arquivo 2>&1
cat arquivo
ls -l /proc/self/fd > arquivo
cat arquivo
ls -l /proc/self/fd 2> arquivo
nano duplicated-fd.md
ls -l /proc/self/fd 2>&1 > arquivo
cat arquivo
fg
ls -l /proc/self/fd &> arquivo
cat arquivo
fg
exec 3> arquivo
ls -l /proc/self/fd >&3 2>&3
cat arquivo
ls -l /proc/self/fd 2>&3 >&3
cat arquivo
ls -l /proc/self/fd 2>&3 >&3
cat arquivo
rm arquivo
ls -l /proc/self/fd 2>&3 >&3
cat arquivo
exec
ls -l /proc/self/fd 2>&3 >&3
cat arquivo
l
exec 3> arquivo
ls -l /proc/self/fd 2>&3 >&3
cat arquivo
l
nano duplicated-fd.md
jobs
fg
nano duplicated-fd.md
kill 285886
killall nano
ps -elf | grep nano
kill 286529
kill 286435
ps -elf | grep nano
kill 286548
ps -elf | grep
jobs -p
nano duplicated-fd.md
xclip duplicated-fd.md
ls -l /proc/self/fd >&3
cat arquivo
exec 3>&-
ls -l /proc/self/fd >&3
l
rm arquivo
ls -l /proc/self/fd > arquivo
cat arquivo
cawk
cawk
fpkg
up
fpkg
upg
cawk
cd git/gitea/cawk/
l
nano cawk
cawk
git add .
git commit -m 'now, results go to history!'
git push origin main
cawk -h
bash --version
cd git/gitea/cawk/
man ./cawk.1
echo 2+2 | cawk
echo 2+2 | cawk -e
echo 2+2 | cawk
echo 2+2 | cawk -f 4
man ./cawk.1
cawk -h
cd git/gitea/cawk/
l
nano README.md
man ./cawk.1
nano README.md
cd git/gitea/cawk/
cp ../debfetch/Makefile .
cp ../debfetch/debfetch.1 cawk.1
l
nano cawk.1
nano Makefile
l
git add .
git commit -m 'man page and makefile'
git push origin main
git add .
git commit -m 'readme updated'
git push origin main
cawk
fpkg
l
ed duplicated-fd.md
htop
debfetch -l
doc/csp/scripts/myfetch
kpci
up
upg
up
sudo apt autoremove
up
cd git/gitea/cawk/
man ./cawk.1
cat README.md
nano cawk
man ./cawk.1
cat /usr/share/man/man1/cat.1.gz
man ./cawk.1
man neofetch
man ./cawk.1
nano cawk
cawk
man ./cawk.1
cawk -h
man ./cawk.1
cawk -h
man ./cawk.1
tmate
cd ~/doc/cbps/turma-b/
l
lenovo
cd -
~
bash --version
LC_ALL=C ls --version
cd tpl
cat ns.tpl
sed -E 's/(%FILE%|%DATE%|%YEAR%|%AUTHOR|%EMAIL%)/TESTE/' ns.tpl
sed -E 's/(%FILE%|%DATE%|%YEAR%|%AUTHOR|%EMAIL%)/TESTE/g' ns.tpl
sed -E 's/(%FILE%|%DATE%|%YEAR%|%AUTHOR%|%EMAIL%)/TESTE/g' ns.tpl
l
read a m <<< $(< author.tpl)
echo $a
echo $m
read -d $'\n' a m <<< $(< author.tpl)
echo $a
help read
IFS='\n' read a m <<< $(< author.tpl)
echo $a
echo $m
echo $a $m
IFS=$'\n' read a m <<< $(< author.tpl)
echo $a $m
IFS=$'\n' read a m <<< $(echo $(< author.tpl))
echo $a $m
IFS=$'\n' read a m <<< author.tpl
echo $a $m
IFS=$'\n' read a m < author.tpl
echo $a $m
read -a data < author.tpl
echo ${data[@]}
echo ${data[0]}
help readarray
mapfile data < author.tpl
echo ${data[0]}
echo ${data[@]}
ns
ns teste
help mapfile
ns teste
l
cat short-gpl3.tpl
ns teste
l
ns teste
l
ns teste
emacs -nw
typr ed
type -a ed
l
rm teste
ns teste
man nohup
ns teste
ns
ns teste2
ns teste3
rm teste*
l
cd git/gitea/
cd cawk/
nano cawk
git add .
git commit -m 'usage updated'
git push origin main
cawk -h
nano cawk.1
nano cawk
cawk -h
nano cawk
git add .
git commit -m 'usage and man page updated'
git push origin main
~
l
mv duplicated-fd.md not/
l
rm arquivo
cd tpl
l
cp ~/git/gitea/cawk/cawk .
l
mv cawk ns.tpl
l
chmod -x ns.tpl
l
nano ns.tpl
nano author.tpl
l
nano short-gpl3.tpl
nano ns.tpl
date '+%b %d, %Y'
read x x year <<< $(date '+%b %d, %Y')
echo $year
echo $REPLY
echo $x $x $REPLY
echo $x $y $REPLY
read month day year <<< $(date '+%b %d, %Y')
echo $day $month $year
echo $month $day $year
read day month year <<< $(date '+%d %m %Y')
echo ${month^} $day, $year
read day month year <<< $(date '+%d %b %Y')
echo ${month^} $day, $year
read day month year <<< $(date '+%d %B %Y')
echo ${month^} $day, $year
read day month year <<< $(LC_ALL=C date '+%d %B %Y')
echo ${month^} $day, $year
read d m y <<< $(date '+%d %b %Y')
echo ${month^} $day, $year
echo ${m^} $d, $y
nano ~/bin/ns
xclip ~/bin/ns
xclip ns.tpl
xclip author.tpl
xclip short-gpl3.tpl
saida='nome endereço telefone'
read n e t <<< "$saida"
echo $n - $e - $t
saida=$'nome\nendereço\ntelefone'
mapfile -t dados <<< "$saida"
echo ${dados[0]} - ${dados[1]} - ${dados[2]}
saida=$'João;Rua das Couves;11 9123-4567\nMaria;Rua das Flores;12 9123-4567'
echo "$saida"
while IFS=';' read n e t; do echo $n - $e - $t; done
while IFS=';' read n e t; do echo $n - $e - $t; done <<< "$saida"
while mapfile -t dados; do echo $REPLY; done <<< "$saida"
mapfile -t <<< "$saida"
help mapfile
str_replace() { local s r str i; str="$3"; mapfile -td',' s <<< "$1"; mapfile -td',' r <<< "$2"; for i in ${!s[@]}; do str=${str//${s[i]}/${r[i]}}; done; echo "$str"; }
type str_replace
type -a str_replace
type -f str_replace
type -a str_replace
str_replace 'a,b,c' '1,2,3' 'abacate laranja limão'
str_replace() { local s r str i; str="$3"$''\n'; mapfile -td',' s <<< "$1"; mapfile -td',' r <<< "$2"; for i in ${!s[@]}; do str=${str//${s[i]}/${r[i]}}; done; echo "$str"; }
str_replace() { local s r str i; str="$3"$'\n'; mapfile -td',' s <<< "$1"; mapfile -td',' r <<< "$2"; for i in ${!s[@]}; do str=${str//${s[i]}/${r[i]}}; done; echo "$str"; }
type -a str_replace
str_replace 'a,b,c' '1,2,3' 'abacate laranja limão'
str_replace() { local s r str i; str="$3"; mapfile -td',' s <<< "$1"$'\n'; mapfile -td',' r <<< "$2"$'\n'; for i in ${!s[@]}; do str=${str//${s[i]}/${r[i]}}; done; echo "$str"; }
type -a str_replace
str_replace 'a,b,c' '1,2,3' 'abacate laranja limão'
str_replace() { local s r str i; str="$3"; mapfile -d',' s <<< "$1"; mapfile -d',' r <<< "$2"; for i in ${!s[@]}; do str=${str//${s[i]}/${r[i]}}; done; echo "$str"; }
type -a str_replace
str_replace 'a,b,c' '1,2,3' 'abacate laranja limão'
mapfile
str_replace() { local s r str i; str="$3"; mapfile -d',' s <<< "$1"$'\n'; mapfile -d',' r <<< "$2"$'\n'; for i in ${!s[@]}; do str=${str//${s[i]}/${r[i]}}; done; echo "$str"; }
str_replace 'a,b,c' '1,2,3' 'abacate laranja limão'
str_replace() { local s r str i; str="$3"; IFS=',' read -a s <<< "$1"; IFS=',' read -a r <<< "$2"; for i in ${!s[@]}; do str=${str//${s[i]}/${r[i]}}; done; echo "$str"; }
str_replace 'a,b,c' '1,2,3' 'abacate laranja limão'
type -a str_replace
str_replace 'a,b,c' '1,2,3' 'abacate laranja limão'
type -a str_replace
# Uso: str_replace csv_busca csv_subst string
str_replace 'a,b,c' '1,2,3' 'abacate laranja limão'
str_replace 'banana' 'maçã' 'banana verde'
str_replace 'banana,de' 'maçã e pera,des' 'banana verde'
type -a str_replace
# Uso: str_replace csv_busca csv_subst string
str_replace 'a,b,c' '1,2,3' 'abacate laranja limão'
str_replace 'banana,de' 'maçã e pera,des' 'banana verde'
str_replace 'banana,çã,ra,de' 'maçã e pera,çãs,ras,des' 'banana verde'
help read
read -a x -a y <<< 'a b c' 'c d e'
mkcd lib
nano balib.sh
. balib.sh
in_string teste 'isso é um teste'
echo $?
type -a in_string
nano balib.sh
. balib.sh
in_string teste 'isso é um teste'; echo $?
in_string peste 'isso é um teste'; echo $?
in_string isso 'isso é um teste'; echo $?
in_string 'é um' 'isso é um teste'; echo $?
nano balib.sh
cd lib
. balib.sh
is_number
is_number; echo ?
is_number; echo $?
is_number 10; echo $?
is_number 10e2; echo $?
is_number 10ee2; echo $?
is_number 0x10e2; echo $?
. balib.sh
is_number 080; echo $?
is_number 0x80fd; echo $?
cawk
lenovo
tmate
ips
startx
doc/csp/scripts/myfetch
less doc/csp/scripts/myfetch
read -ei 5 -p cycles
echo $REPLY
read -ei 5 -p "Cycles: "
echo $REPLY
ns tomatosh
rm tomatosh
ns teste
rm teste
ns tomate
nano bin/ns
l
nano tpl/ns.tpl
nano bin/ns
./tomate
chmod +x bin/upt
upt
time uptime -p
time upt
time uptime -p
time upt
cat /proc/uptime
time upt
cat bin/debfetch
cat tpl/short-gpl3.tpl
upt
upt -h
cat --help
uptime --help
upt -h
cat /proc/uptime
date -d'@38650'
upt
date -d$(( $(date +%s) - $(cat /proc/uptime | cut -d'.' -f1) ))
date -d"@$(( $(date +%s) - $(cat /proc/uptime | cut -d'.' -f1) ))"
upt
upt -s
upt
upt -s
upt
upt -s
upt
upt -d
upt -h
upt -p
upt -pd
upt -p
upt -pd
time upt
time upt -p
time upt -pd
time upt -s
time upt -h
upt -h
upt
upt -d
upt -dp
upt -s
uptime
uptime -p
uptime -s
uptime -spd
upt -spd
upt -pds
upt
upt -d
upt -p
upt -pd
upt -s
upt -h
upt -s
upt
cd git/gitea/
git clone git@git.blauaraujo.com:blau_araujo/upt.git
cd upt
l
mv ~/bin/upt .
l
ln -s ~/git/gitea/upt/upt ~/bin/upt
upt
upt -h
upt -h | xclip
nano README.md
git add .
git commit -m 'first commit'
git push origin main
l
git config user.name blau_araujo
git config user.email blau@debxp.org
git commit --amend --reset-author
git push origin main
nano README.md
git add .
git commit -m 'first commit'
git push origin main
cd git/gitea/upt/
l
man ./upt.1
upt -h
man ./upt.1
cp ../cawk/Makefile .
cat ../cawk/README.md
l
git add .
git commit -m 'README.md, man and help updated'
git push origin main
uptime -p
lenovo
cd ..
~
l
rm -rf Desktop/
l
rm tomate
l
cd prj/
l
mkcd goto
ns goto
fzf
type -a fzf
cat ~/bin/fzf
cat ~/bin/fpkg
bash goto
source goto
goto
source goto
goto
source goto
goto
..
source goto
source goto/goto
goto
source goto/goto
goto
l
goto
source goto/goto
goto
cd /
goto
cd -
source goto/goto
goto
source goto/goto
goto
source goto/goto
goto
source goto/goto
goto
source goto/goto
goto
source goto/goto
goto
source goto/goto
goto
source goto/goto
cd prj/
source goto/goto
goto
cd prj
source goto/goto
goto
cd prj
source goto/goto
cd prj
goto
cd prj
source goto/goto
goto
source goto/goto
goto
source goto/goto
goto
source goto/goto
goto
cd prj
source goto/goto
goto
source goto/goto
goto
apti locate
man locate
locate *
locate
locate --help
locate -d .
locate -d ./
locate ./
locate "*"
locate *
locate */
uptime
uptime --help
upt -h
nano bin/upt
upt -h
nano bin/upt
upt -h
uptime --help
upt -h
cd git/gitea/upt/
l
cp ../cawk/cawk.1 upt.1
l
ed upt.1
l
l bin/ms
l
lenovo
lenovo
l
lenovo
tmate
cd git/gitea/cawk/
l
cawk
cawk -e '2 + 2'
cawk -e 'a = b'
cawk -e '1a = b'
cawk
help history
cawk '1=2'
cawk
cawk -e '1=2'
cawk -e '2+2'
cawk -e '2+2' -f10
cawk -e '1=2'
cawk -e '2+2' -f10
cawk
cawk -e 'sqrt(2)' -f10
cawk
help history
cawk
cat ~/.bash_history
help history
cawk
teste
history -s -1
history -s '-1'
1
\-1
history -s \-1
\-1
cat ~/.bash_history
history
history -s -(1)
history -s "-(1)"
history -s -a
history -s -909
*-2
history -s -9-10
history -s --9
history -w -1
history -w "-1"
history -w " -1"