Software :: Shell Script Using An If Statement And "wall"?
Apr 17, 2011
made a simple script called "msg" to make it simpler to use the "wall" command, but it is giving me some issues. The problem is more cosmetic than performance, but it's annoying.OS:Ubuntu 10.10 Text Editor: Nano (Probably not important, but hey...)Here's what I got:
We are building our C++ project in Kdevelop IDE. Every time we run "Run Configure" from the "Build" menu, a file named "libtool" gets automatically generated. This file contains a statement as "ECHO="echo"".f we run "Automake", without modifying the "libtool" the system hangs and theputer needs to be restarted.Therefore every time we run "Run Configure" we need to include the line "echo="echo"" below the statement "ECHO="echo"" manually.I think a script can be written which does the above on its own.I am not a shell script programmer, I know the good tutorials for shell scripts are available on the net, but learning scripting only for this task would be time-consuming and painful.
Im a bit stuck with a simple script that im practicing with... im trying to get my head around some simple scripting. Basically i want to write a script that will work as below: It will ask the user to enter their userid. If its correct it will say 'Correct' If its the wrong id (But the ID exists in /etc/passwd) then it will say 'incorrect' If its not a valid userid it will say 'doesnt exist'. What i have so far is:
[Code]...
# If the user enters their own userid they will get a comment saying 'correct' $LOGNAME) echo "Correct";;
# If they enter another users ID (That exists in the /etc/passwd), then they get a message to say 'incorrect userid used'. Im not sure what i need to do here to get it to check the /etc/passwd to see if the input exists in there.... im guessing some kind of simple 'if' statement to say ---- "if 'input' exists in /etc/passwd then echo "incorrect userid used"
# If its entered incorrectly and not a valid ID then they will get this comment. Again, im guessing this part would be similar to te above option..... *) echo "not a valid ID";;
Ive managed to work out how the basic Case staements work, but to add a conditional statement based on the input, i just cant figure out. I have tried looking on google, and found some help but it doesnt really explain how i check the input against the /etc/passwd.
Are there any other options for a fire wall gui for opensuse where you can see exactly what is going on with the firewall? I am finding the yast firewall gui in opensuse 11.4 to be extremely limited. I am not proficient in ip tables so looking for something that would give better control over the firewall rules for a beginner.
i have enbled desktop wall in compiz. problem is, it seems that i only have two viewports available (left and right), whereas i see viewports way more than two in screenshots and videos videos. how do i go about this?
I'm in the middle of creating a new web page & want to have a certain Facebook wall show up on one of the pages_[ Is this possible & if sooo how can I accomplish ]
Is there a way to monitor a wall outlet with nagios.I want to check if we got some power out of a wall outlet.This is to check whether we are running on the electricity network or on our diesel power generator.The wall outlet is connected only to the electricity network, so if there is no more power coming out of the outlet that mean that we are running on the diesel power generator.
It's an acer Aspire One D257-13478.Download the correct firmware and tar it into the appropriate dirctories and I'm still running a wall.I don't know how to get the b43/b43legacy in the lsmod list.I've also tried use the rfkill command and using yum to install it gives me this response:"cannot retrieve repository metadata" I also went into the F2 setup menu and couldn't find anything to alter the bios wireless.After installing Fedora 15 almost all the drivers remained intact including enumerators for usb mice.I don't know what's going on.
I can't access the web interface for cups to install a printer on Ubuntu server 10.4 tell me how to get it working right or i'll just throw the computer out the window and go with windows server, a much better, user-friendly product, like all Microsoft creations
With wall command, we can just broadcast a message to all the login users in only system, how to broadcast a message to all the systems which all are in same network
I've had 8.04 for almost a year & a half now, but the one thing that seems to confuse me after getting the rest of ubuntu is how to get wifi working. Before you say "read XXX FAQ, wiki, page", etc, I've read so many and despite understanding every normal thing about ubuntu, and all the customization I have, I haven't seen a single, up-to-date guide for making sense of wifi.
Here's what I know:
My wireless card is Network controller: Intel Corporation PRO/Wireless 2915ABG Network Connection (rev 05), supported in linux only by using a windows driver, ipw2200, which I do have running and installed somehow.
I also realized I needed ndiswrapper, so I installed that. Beyond this, I'll just admit it- I'm very confused. I have always had a working connection over ethernet cable plugged in, but I really need wireless lately, and found an old Netgear WGR614v7 G band wireless rounter in my basement, hooked it up, and have a wired connection from it right now.
So how do I set-up/get my wireless working with all this thus far? How do I set up the router's network through Ubuntu as well, so I can create a named network to connect to? I'm reading every guide I can, and am just coming up more confused.
I am trying to get the time of my wall clock from my wireless driver in form of "hh:mm:ss", so I used the function get_rtc_time() inside my driver to get that and it was done. My question: Is it possible to increase the accuracy of this function, for example if I want to get the milliseconds and the Microseconds in additional to the first output? If not, Is there any other function can do that?
I have multiple drives and software that defaults to my primary drive. I want to change preferences to use my second drive.This is the current path "/home/guy/dvdrip-data" my second drive is named "2Internal".How do I properly format the path statement to use the second drive?
I am trying to create a script to be used on RHEL server. If I replace the $t with a number, the script works. If I try add a variable or the $1, the script doesn?t work (returns all processes even if less than the $t value). I thought that it may be treating it as a literal, but I wasn?t sure of the conversion.
I have returned the below mentioned lines of code however I am receiving error "Syntax Error On Done Statement".
while: do clear echo "-------------------------------------------------------------------" echo "Main Menu" echo "-------------------------------------------------------------------" echo "[1] Today's Date" echo "[2] Show files in the current Directory" read yourch case $yourch in
1) echo "Today is `date`,press a key ........";read;; 2) echo ls -l;read;; *) echo "Select the yourch as 1 or 2";
the script below prints the pwd of where I want to be. after the fi it puts me back at the original dir. just writing these scripts to understand what's going on.
#! /bin/bash if [ -d mydir ] then cd mydir/ && pwd fi
When you use an if statement directly in bash you have to put the ";" at the end or not? or am I mixing it with the for loop? I am reading advance bash scripting and it shows the if - then statements without ";" so I need a little clarification here.
I have a site which will have, for example, a login system where people have to enter their usernames and passwords, depending on which they'll be let in to the site. So, in code, I've got a line like:
if ($_POST['password'] == $password) { then do whatever } else { print "Wrong password" ; )
My problem is, this "Wrong password" printing is just a solitary line, not keeping with the colours and style of the site, and it looks very bad. I want to ideally, output some HTML, which will have a picture, and print the "Wrong password" in the font and colours I desire. Do I have to put all the HTML in a print statement, and then deal with the nightmare of escaping all the quote marks in it with a ""? Or is there a cleaner method to the whole thing? Maybe something like this -
if ($_POST['password'] == $password) { then do whatever }
I'm trying to code a sql statement for use in a PHP script.I'm looking to find the number of matching records in two tables and display them.How would you write that statement.I've tried using count a few ways, but no cigar.
I am running Debian Squeeze, 64-bit.I would like to try my hand at bash scripting. So at the author's suggestion (first chapter of Chris F. A. Johnson, Pro Bash Scripting from apress) I created a /bin directory in my home directory. So now I would like to modify my PATH statement so that when I run a script from my bin directory my shell will find it.I did that. He then says that I should add this to ".bash_profile, .bashrc, or .profile depending on how bash is invoked." The find command is unable to locate any of these files. So I searched the forum, found the link above and tried to follow that. No luck so I assume that how Debian handles PATH statements has changed since that post?
I also have checked the wiki and worked Google as hard as I know how to do.Very simply where the heck is my PATH statement and how do I modify it?
My bank statement s get delivered via email but they require a special decoder to be read. I got the decoder here [URL].. (the gui version), extracted it and tried to install it but the terminal gives me the following message:
bigseb@bigseb-laptop:~/Documents/reader$ sudo rpm -i /striata-reader-1.0-27-linux-2.4-intel rpm: please use alien to install rpm packages on Debian, if you are really sure use --force-debian switch. See README.Debian for more details. bigseb@bigseb-laptop:~/Documents/reader$