Skip to content

Tag: shell

Prevent accidental history editing in bash

I recently switched from tcsh to bash, and one thing that keeps tripping me up is how bash handles history. I regularly bring up a previous history command and begin to edit it, but realize I need to run a different command first. In bash, this edits the original command, and I cannot see what I originally ty…

How to repeat a dash (hyphen) in shell

How can I repeat the character – n times in shell? I have read and tried this, but this does not work for -. It throws error invalid option. Below is the exact command that I used: Original posted line: printf ‘-%0.s’ {1..100} I also tried escaping – by putting a but in that case it r…

Run bash whiptail script after login with sudo

I’m creating a virtual machine configuration script using whiptail that I’d like to have automatically start after the user logs in. The thing is, that I don’t want the user to be root, however because the user will need to be able to change things like hostname, ip address, add directories,…

Get a radius of a circle in bash shell

I need to write a script to find radius of a circle and then find the area while the circumference is given The formula is: RADIUS=CIRCUMFERENCE/(2 * PI) The problem is I cant make this formula work because bash doesn’t accept decimal division I read a lot of answers there but still can’t get what…