Here’s a nice little command to open a browser from Bash.
#!/bin/bash open https://domain.com/path/to/web/page/index.html |
You can use this command to open a web page from your script.
cloud engineer
Here’s a nice little command to open a browser from Bash.
#!/bin/bash open https://domain.com/path/to/web/page/index.html |
#!/bin/bash open https://domain.com/path/to/web/page/index.html
You can use this command to open a web page from your script.
Here’s the script to add pauses in your Bash script.
echo "please wait until web page loads ... " read -p "Press any key to continue... " -n1 -s |
echo "please wait until web page loads ... " read -p "Press any key to continue... " -n1 -s
You can also put it inside a function and call it multiple times.
function press_any_key { echo "please wait until web page loads ... " read -p "Press any key to continue... " -n1 -s } press_any_key |
function press_any_key { echo "please wait until web page loads ... " read -p "Press any key to continue... " -n1 -s } press_any_key
A recent OS upgrade rendered the crontab to malfunction on macOS Monterey. It turned out the system just needed a reset of System Preferences > Security & Privacy > Privacy tab, and to make sure cron has full access to disks. Once you flipped that, your crontab should start working. Hope that helps.
If you’re into photography, you would know what crop factor means. I have a Nikon D90 camera with a crop factor of 1.5. For example, if you use a 24mm full frame lens on a D90, the focal length will be 36mm. So, here’s a handy bash script that calculates the crop factor by multiplying the full frame focal length by 1.5.
#!/bin/bash if [ $# -eq 0 ] then echo "Usage: cropfactor.sh 24" exit fi a=$(echo "1.5 * $1" | bc) echo "Cropfactor focal length is: " $a"mm." |
#!/bin/bash if [ $# -eq 0 ] then echo "Usage: cropfactor.sh 24" exit fi a=$(echo "1.5 * $1" | bc) echo "Cropfactor focal length is: " $a"mm."
Result
ulysses@penguin:~/Code$ ./cropfactor.sh 24 Cropfactor focal length is: 36.0mm. |
ulysses@penguin:~/Code$ ./cropfactor.sh 24 Cropfactor focal length is: 36.0mm.