Differences between version 48 and revision by previous author of BashNotes.
Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History
Newer page: | version 48 | Last edited on Tuesday, December 26, 2006 12:55:58 am | by BenStaz | Revert |
Older page: | version 42 | Last edited on Thursday, August 3, 2006 9:51:33 pm | by AristotlePagaltzis | Revert |
@@ -34,8 +34,12 @@
<verbatim>
xset b 0
</verbatim>
+
+If you use gnome, then that annoying beeping can be disabled by going to System > Preferences > Sound
+
+Find the "System Beep" tab and uncheck "Enable System Beep".
!! How do I do arithmetic in bash?
Surround the expression with $(( )), eg:
@@ -344,11 +348,34 @@
END_SCRIPT
</verbatim>
—AristotlePagaltzis
+
+!How can I do Division in bash using floating point numbers?
+
+Use ''bc''
+
+*echo "scale=10;5/4" | bc"
+
+will result in : 1.2500000000
+The value of the scale function is the number of digits after the decimal point in the expression. (In this case 10)
+
+!How Can I use ''and'' / ''or'' in bash if statements?
+
+
+*You can do boolean OR in BASH by using the -o operator.
+*You can do boolean AND in BASH by using the -a operator.
+
+Try intermixing the two also.
+
+<verbatim>
+if [ $bla -eq 1 -o $cars -eq 3 -o $monkeys -eq 4 ]; then
+ echo "Westside"
+fi
+</verbatim>
!! See also
* CommonErrors, under "Your shell hangs"
* BashOneLiners
* SpacesInPathNames
* PortabilityNotes