Programming :: Select The Branch Based On The INPUT?
May 23, 2011
I want to select the branch based on the INPUT. Here is the program segment which uses the case statement.
case $INPUT in
1)branch="Computer Science";;
2)branch ="Electrical";;
3)branch = "Mechanical";;
4)branch= "Aerospace";;
esac
When I run this script, I am getting an error, Electrical command not found?
View 2 Replies
ADVERTISEMENT
May 3, 2011
I'm trying to call a specific variable based on a user selection. For example:
Code: Select a file:
[1] foo.tar
[2] bar.tar
Enter a selection: I have already coded each possible selection to have its own variable. If the user selects 2 I need to select $SELECTED_TAR2, or if they select 1 I need to select $SELECTED_TAR1 and then do something like this behind the scenes:
Code: cp /home/user/$SELECTED_TAR2 /home/user/backup/$SELECTED_TAR2
I was thinking something like this:
Code: echo "Enter a selection: "
read -e SELECTED_NUMBER
cp /home/user/$SELECTED_TAR$SELECTED_NUMBER /home/user/backup
[code]....
View 2 Replies
View Related
Jul 27, 2010
I am splitting a file based on the values read from an input file. The below one is the script.
1)How do I add the header which is present in the original file to the new split files created?(For eg. pharmacyf conatins header as table column names. The new files created (ODS.POS.$pharmacyid.$tablename.$CURRENT_DATE.dat) are without the header).
2) Also the script is creating 0 byte files for the pharmacyids which are not available in the intial file? Can this be avoided?
for pharmacyf in *
do
tablename=`echo $pharmacyf |cut -f4 -d'.' `
while read pharmacyid
do
grep -w $pharmacyid $pharmacyf >> $OUT/ODS.POS.$pharmacyid.$tablename.$CURRENT_DATE.dat
done< inputfile
done
View 2 Replies
View Related
Mar 24, 2010
I am trying compile a daily task that requires numerous steps all into one bash script to make life easier..My problem is that as part of this wrapper scripti have to call another script that is menu based and requires input from the user.Below is the menu
1) Start x Process
2) Start y Process
3) Start z Process
code]...
View 9 Replies
View Related
Mar 25, 2010
initializing a branch in one Launchpad project on multiple computers, or even upon reinstalling an OS? I know I sure haven't.
View 1 Replies
View Related
Feb 11, 2011
I want to select lines from FileA based on a key field in FileB.
egrep does this nicely:
"egrep -w '0132874|0132880|0100765' < " FileA
Suppose FileB consists of three lines:
0132874
0132880
0100765
Is there a way to code egrep to do the selection? I really like code which does not use explicit loops so my interest is to find a grep or egrep or sed (or some other) command to perform this function.
Neither file is sorted on the key field but they could be. There is no requirement to keep the files in their present order.We may assume that each key value in each file is unique.
View 2 Replies
View Related
Jul 6, 2010
I use a USB webcam with a built in microphone. It works fine, but every time I plug it in I have to go to sound properties and select it as the input device. There are no other input devices present on my system. Since it's the only one there, is there any way to get it to automatically select when I plug it in? If not, I think that would be good functionality to add. Does anyone know who or what team to contact about that?
View 3 Replies
View Related
Feb 9, 2011
How to select input source in Audacity?
View 1 Replies
View Related
May 4, 2011
I have a pair of interfaces bringing in traffic from multiple vlans each. I need to route or forward traffic to and output interface based on the physical interface and source IP address in the packet.I have multiple ip rules to send traffic to custom routing tables and each of those custom tables had a default route out the appropriate interface, but traffic isn't flowing. Afterwards I tried using iptables and put an ACCEPT any statement in every chain of every table. What am I missing, ebtables maybe??
View 1 Replies
View Related
Jan 28, 2011
I have a computer with a trackpad and a touchscreen. I want to run unclutter if I use the touchscreen, and kill it when I use the trackpad or a USB mouse.
The I'm pretty sure the touchscreen is /dev/input/mouse0, and the trackpad is /dev/input/mouse1
I have a general idea of how this should work, but no idea what tools and commands to use to implement it.
View 1 Replies
View Related
Jan 15, 2010
I have currently had the need to go back to basic socket programming, and implemented a simple udp packet sender. But I realized I needed to be able to select which network interface to send the packets from.
The reason is so that one of the interfaces has vlan tagging, and I need my UDP packets to be accordingly vlan tagged. For example, one of the interfaces is eth1.200.
View 2 Replies
View Related
Jan 21, 2011
I recently started shell programming and my task now is to do a menu display.Currently i am stuck whereby user will input both title and author and it will delete it.
Do i have to use sed command?
View 4 Replies
View Related
Apr 22, 2010
Does anyone have a acl patch for cvs-1.11.22-5.el5.I need to implement rw acl on branch and tag names.
View 2 Replies
View Related
May 3, 2010
I can't remember if branch is the correct term but I am talking stable, testing or unstable.
i have looked through the dpkg and aptitude man pages but can't seem to find if there is a way to search which packages on the system are installed from a specific branch. Is there a way to do this?
View 2 Replies
View Related
Dec 8, 2010
I have a process that forks, where the childs puts some data of random size and exits while the parent should get the data and does some manipulation.. here I have used a pipe for child to write the data and parent to read the data.. Child simply dumps the data, and the data is of any size even child and parent doesnt know.
I have used select in the parent to see whether there is any data coming on the reading end of the pipe.. if there is a data.. I copy into a buffer.. Im reading the data continusly when the child exits after closing the writing end of pipe. Parent gets blocked on the read part But my question is how parent know the other of pipe is closed when using the select call. In otherwords.. while using select in readfds, how would i know the other end has closed the pipe..
View 2 Replies
View Related
May 23, 2011
Im wondering how to create a menu in c like bash's select. I imagine there is already something out but I don't know what it would be. Im a c newb but been scripting for a long time now and trying to pick up a little c.this would be what I am looking to display:
Code:
1) option 1
2) option 2
3) option 3
Make a selection:obviously 1,2,3 would be the only valid selection and anything else would say invalid or something like that.
View 2 Replies
View Related
Dec 2, 2010
Trying to export a Mysql query to a .csv file the query draws from multiple tables, e.g. sales, purchase and currency
Code:
What i'm trying to do is to export both the sales and purchase to a single line where both the currency for the sales and the purchase is specified.
Basically like this:
Code:
Problem here is that i'm stating currency.value twice in the same select and don't know how to define which currency.value applies to sales and which to purchase.
View 7 Replies
View Related
Feb 9, 2011
I'm trying to make a very small script with greasemonkey to do some automatic things when a page loads. The first thing I need to do is to click on a link. I've done that. Then I need to select the 3rd element of a drop down list that appears a few moments (depending on the connection) after the link is pressed, without reloading the page (ajax or something like that). This I can't get to work, The select has no id or class, but I can get its xpath value. There is only one select on the page. I've tried both setTimeOut and the DOMNodeInserted event with no effect.
Code:
// ==UserScript==
// @name test
// @namespace "www.google.com"
// @include www.mywebpage.com
// ==/UserScript==
[Code]....
View 11 Replies
View Related
Jun 8, 2010
Assume this array in Korn:
Code:
HOSTS[ home ]="163.164.165.166"
HOSTS[ work ]="122.123.124.125"
[code]....
View 3 Replies
View Related
Apr 19, 2010
I'm writing a PHP script, and I need a top 10 result from a mysql query.I've tryed like this:select IP,sum(download) from traf group by IP order by ASC limit 0,10and my sql returnsmysql> select IP,sum(download) from traf group by IP order by ASC limit 0, 10;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ASC limit 0, 10' at line 1As I red through Google this is not quite supported by mysql, so is there another way to do this?
View 5 Replies
View Related
Jun 23, 2011
I am missing the brunch "/apps/nautilus" in gconf in Fedora 15. Is there any other way how to control Nautilus settings (e.g. set nautilus to show "advanced permissions" in file properties) ?
View 2 Replies
View Related
Aug 24, 2010
I inadvertently upgrade to Ubuntu 10.10 developmental while trying to upgrade to Ubuntu 10.04.1. Can anyone can in downgrading back to a stable release without having to reformat everything?
View 4 Replies
View Related
May 26, 2011
I need to know how to assign a result from a select. I am clueless on the sytax. I am trying this in bash. Maybe I am not assigning the array right. It gives me the whole row in the echo instead of just field a. How do I get fieldA = a in the select. Note script was stripped for security on database info but the syntax is same.
Code:
#!/bin/sh
results="$(mysql --user ${DB_USER} -p${DB_PWD} ${DB_NAME} -Bse 'select a,b,c,d from tblMytable')"
for rows in "${results[@]}"
do
fieldA=${rows[0]};
echo ${fieldA};
done
View 2 Replies
View Related
Jun 24, 2010
I'm facing a strange problem with our code. What the program does is to wait on a select() after a non-blocking connect. And I expect the select wake up with write_set after the ESTAB. And I expect select wakeup with both rd_set and wr_set if I recv a RST back for our SYN or any similar errors. But in one of the cases I'm seeing select is waking up with only rd_set in a non-connected sockeet, which is causing a lot of problems for me.
The code is organized such that the socket close() happens only in wr_set processing. Because of that with the above problem I'm going in to a strange scenario. After the event I call select() again and wait for another socket event. But with this issue, my select is waking up there after everytime as soon as I call select(). That too only with rd_set. So it keeps on going with select() sleeping 0 secs. Thus the program is hung and eating lot of CPU cycles also.
The trigger for all these problems seems to be some event which causes the waking up of select() with rd_set only. I tried many ways to find out what is happening with this. Couldn't find anything interesting yet.
View 1 Replies
View Related
Jun 9, 2010
I am using C++ with SQLite db in a program that will read read a sub set of records, compare records and write different records to another database. I have a SQLite book, but it only shows examples for the C API. Anyone have code samples in C++ for the following:
Open database
Close
Select *
Read
Write
Or, just show me how to execute a SQL statement with C++ and I can then figure out the various SQL statements I need.
View 5 Replies
View Related
Nov 18, 2010
I usually use wget to download stuff from websites when scripting.I have a new requirement that requires me to authenticate then select some options to execute the download. How would I go about this? First thing that comes to mind is using keyboard macros in the Windoz world but I need to do this in bash or perl.
View 1 Replies
View Related
Aug 10, 2010
Quote: Security expert Georgi Guninski has pointed out a security issue in the 1.0 branch of OpenSSL that potentially allows SSL servers to compromise clients. Apparently the hole can be exploited simply by sending a specially crafted certificate to the client, causing deallocated memory to be accessed in the ssl3_get_key_exchange function (in ssls3_clnt.c). While this usually only causes an application to crash, it can potentially also be exploited to execute injected code.
View 1 Replies
View Related
Feb 18, 2011
Dear all
I am new to git (and storing multiple copies of my code).
I was using git for one month (git status, git add, git commit) to store my files.
I have problems to add more files to my branch
git add BasisExpansion.R
fatal: Unable to write new index file
this was working great unless the day my system administrator destroyed my main partition (it was an accident) and installed everything from scratch. My home directory stayed intact (I did not lose any files not git files that are stored under /home). But from this point of time git returns always that error. My system administrator creater the same user and group as my old user was but this didnot fix the problem.
I am not sure If I can recover my old git structure or would it be better to wipe out the old git dir and start a new one?
View 8 Replies
View Related
Nov 6, 2013
I have mysql installed successfully. I can insert rows into my table using phpMyAdmin. I can successful retrieve those rows in PHP with a select statement. However, I cannot insert or update rows from PHP. I get no error messages and everything appears to be working okay, just no results in mysql table.
View 0 Replies
View Related
Jan 28, 2010
As i am new to C++ i couldn't figure out how to input a file and make some change on the file and produce a output file. like this problem i have is.
"Program that processes an input file and produces an output file. The input file will contain lines of data, each containing two floating point numbers. The lines of the output file should contain the two numbers read and their average (with a '$' sign and 2 places after the decimal point)."
View 2 Replies
View Related