#!/bin/bash# example of using arguments to a scriptecho "My first name is $1"echo "My surname is $2"echo "Total number of arguments is $#" #ShellScript #Example
🆔 @ai_python
#!/bin/bash# Counting the number of lines in a list of files# for loop over argumentsif [ $# -lt 1 ]then echo "Usage: $0 file ..." exit 1fiecho "$0 counts the lines of code" l=0n=0s=0for f in $*do l=`wc -l $f | sed 's/^\([0-9]*\).*$/\1/'` echo "$f: $l" n=$[ $n + 1 ] s=$[ $s + $l ]doneecho "$n files in total, with $s lines in total"#ShellScript #Example #Linux
🆔 @ai_python
translate() { echo "Translate $1 to persian" xdg-open "https://www.google. com/search?q=$1%20in%20persian"}رو به فایل bashrc. اضافه کنین و از این به بعد کلمه ی انگلیسی که میخواین فارسیش رو ببینید translate رو توی ترمینال بنویسین و جلوش کلمه انگلیسی رو.
نوت: اون فاصله بین google. com رو از بین ببرین(تلگرام اذیت میکرد مجبور شدم فاصله ایجاد کنم)
#Linux
#ShellScript
@ai_python
#!/bin/bash while truedo sleep 3600 notify-send "Get up and walk for 1 minute" sleep 60done &این اسکریپت رو همیشه وقتی در حال کارید ران کنین تا حداقل یکم به فکر سلامتیتون باشین
#Linux
#ShellScript
@ai_python