You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/bin/bash
echo "Bash version ${BASH_VERSION}..."
for i in {0..10..1}
do
echo "Welcome $i times"
sleep 2
done
Example 2
#!/bin/bash
#https://www.cyberciti.biz/faq/unix-linux-appleosx-bsd-shell-appending-date-to-filename/
for i in {0..10..1}
do
now=$(date +"%m_%d_%Y_%H_%M_%S")
echo "Welcome $i times" > "/home/admin/public_html/bash/$now.txt"
echo "/home/admin/public_html/bash/$now.txt File is Saved"
sleep 2
done
Example 3
#!/bin/bash
#https://www.cyberciti.biz/faq/unix-linux-appleosx-bsd-shell-appending-date-to-filename/
for i in {0..11000..1}
do
now=$(date +"%m_%d_%Y_%H_%M_%S")
wget --spider "https://wp-dev.ir/risknews-migration-api/create_post/?user_login=mehrshad&user_pass=5p64g49" 2>&1
if grep --quiet "200 OK" wget-log; then
echo "ok"
else
echo "notok"
fi
echo "Save post $i times" > "/home/admin/public_html/bash/$now.txt"
sleep 2
done
Run Single Bash File
bash post.sh
Run in Baskgorund
# https://stackoverflow.com/questions/17385794/how-to-get-the-process-id-to-kill-a-nohup-process
nohup sh post.sh & >/dev/null 2>&1
When finished editing the file, click the ESC key. This takes you out of INSERT mode and -- INSERT -- disappears from the bottom left of
your terminal.
To save the file, type in a colon followed by wq. For example: