by paracelsus on Sat Feb 13, 2010 11:57 pm
Well I've given up on the hotkey in terminal thing. I have no doubt it can be done but fucked if I can figure it out.
Best I can come up with is write a script to do it, give it a really short name, and dump it in /usr/bin . Not a true hotkey but it's as close as I can get.
Moving on
Test DayThe most basic and important concept in any programing language is the test. Learning about the test program is essential to getting anywhere with bash.
A simple example of what you can do with test
- Code: Select all
#!/bin/bash
if test $USER != root
then
printf "Must be run as root \n"
exit 1
fi
printf "\n Got root! \n\n"
Let's take a closer look at the if
if test $USER != root test is comparing the value of
$USER to the string
root.
!= means the
if will be true if the comparison is false. Variables are called with a
$ and
$USER is a global variable that denotes the user running the script.
So
if the
user is not root then it will print "Must be root" and exit.
Otherwise the script will print "Got root!" and exit normally.
Oh and \n prints a newline
That is just a tiny taste of what test can do and how to use it. To really learn about test check out this guide.
http://tldp.org/LDP/Bash-Beginners-Guid ... 07_01.html
Why are some people terrified of "black helicopters" and don't even notice that they are being monitored almost constantly by the whole network of obvious surveilance cameras, credit cards, ATMs, EZpass, company ID/access cards, magazine subscriptions, SSNs, taxes, fees, video rentals, Internet firewall recording, 'cookies', ... ?