Ubuntu :: Read Not Allowing Operators In Shell Scripts

Dec 26, 2010

I'm trying to write a small application controlling spotify, running under wine, that I can run from my desktop computer and use via SSH on my mobile phone, and so far I've been quite successful. At least until just recently, when I tried to use the read command to read a single key-press on my phone, and use that input instead of having to type the number for item in the menu I've created. I tried to simply use the read command to silently listen to one key-press and output it to the variable opt. To do this I tried:

read -s -n1 opt

When I ran this in a shell-script this I got:

read: 1: Illegal option -s

Seeing this, I tried to remove the -s operator, which left me with:

read: 1: Illegal option -n

I decided to remove all operators and echo the variable opt, leaving me with:

read opt
echo "$opt"

Which worked as expected. It echoed the key that I had pressed. I moved over to my terminal window and tried the read command from there, and it did exactly what it should. It silently recorded one key-press to the variable opt.

why isn't read working with operators in shell scripts?

View 2 Replies


General :: File-permissions On Read-only Media: Allowing For Access Without Chmod?

Mar 14, 2010

I've hit a wall here; I'm attempting to find some way by which to view files and cd into directories on a device mounted read-only. So I need the permissions to read, write, execute (and the same with directories), but chmodding is out of the question because I don't want to alter the drive one iota.

I guess what I could do--what I was thinking of initially--was to dupe the whole drive and then mess with permissions. This wouldn't affect the original (actually I'm working on a duplicate of the original, but I'm treating it as if it were the original) but I was hoping for something that would maintain data integrity. This is a forensic application and not altering the data is very important.

View 2 Replies View Related

General :: Allowing Read Write To Ext3 Partition To Non-root Users

Mar 18, 2010

I need to allow non-root users to read/write on an ext3 partition.

Below is the relevant output from fdisk -l


The partition in question is /dev/sda4 and it is mounted as /Data (setup during installation).

View 2 Replies View Related

General :: Preserving Last Read Value In Shell Script?

Feb 16, 2011

Here are the contents of the file


I want to read file content using shell script and check if the difference between the two line count is 300

View 5 Replies View Related

Programming :: Read A Value From A File In Shell Script?

Mar 12, 2010

So my firefox's profile.ini file looks like this:less .mozilla/firefox/profiles.ini



View 9 Replies View Related

General :: Using File Redirection Operators In Bash?

Sep 3, 2010

What's the difference between using > and >>? How can I use both < and > (redirection operators) in a single command?

View 2 Replies View Related

General :: How Different Operators Change Output Of Command

Sep 5, 2009

I was wondering about the differences between "$PWD" '$PWD' `$PWD`. Basically I just don't understand exactly how '' "" `` change the output of the command.

View 1 Replies View Related

General :: Implementing Logical Operators In Grep?

Dec 14, 2009

How can I implement logical operators in grep? I checked the man info and couldn't figure it out. For example, I'd like to display lines in file1.txt that contains word1 OR word2.
cat file1.txt | grep word1 OR word2

View 3 Replies View Related

Programming :: Bash Background - & - With Control Operators -&&

Feb 11, 2009

I have a set of files to copy and decompress, and want to do these operations concurrently with a script.

Manually it would be something like:


The single & is intended to background the processes, while the && is intended to execute the gzip process if and only if the cp completes successfully.

My script is:


When I run it, bash gets angry with the following error:


So what is the proper syntax to accomplish this?

View 1 Replies View Related

Programming :: How Many Of PHP Functions And Operators Remembered To Code

Jun 7, 2011

So if you are a PHP-programmer (average one) and code for money, how many of funtions and operators of PHP should you remember by heart (in real life)? I was looking through php.net and man there are millions of tons of them!

View 9 Replies View Related

General :: Read A Line Of C Comamnd And Execute In Shell Script?

Nov 9, 2010

I am using following code to read a lien from a file and store the value to a variable $line and execute it.

while read line
./$line &


View 6 Replies View Related

Programming :: Shell Script To Read A Certain Segment Of A Text File?

Jun 15, 2010

I have a text file that looks sort of like this:

blah blah blah
tons of unimportant stuff we don't care about


View 3 Replies View Related

Programming :: Shell Script To Delete Files Which Location Should Be Read From Log File

Jun 26, 2010

I have 2 external hdd in wich I have all my files. yesterday, I have copied all the files from hdd2 to hdd1 and I want to eliminate duplicates so I used FSLint to find them,now I want to make a shell script to delete all the files/entries (read from the log file) that begin with.

View 14 Replies View Related

Software :: Bash Syntax - While Loop With Multiple Comparison Operators

Apr 21, 2009

I'm trying to code the following WHILE loop in Bash:
While [string1 is non zero] and [string2 is non zero] and [counter < max]

I can't get the syntax right. I've tried:
while [ -n "$STRING1"] -a [ -n "$STRING2"] -a [$COUNTER -lt $MAX ]
But I get 'Too may arguments'

View 4 Replies View Related

General :: Write A Shell Script Which Will Read The Directory Path As Input From User?

Nov 28, 2010

I am new to writing shell scripts. So, please bare with me. I am currently trying to write a shell script which will read the directory path as input from user and will traverse the Dir tree to find all available audio and video files. I have tried to write as much as I could but I don't know where I am making mistake as I get some files to be audio file which are actully tar balls. On the second note there are some files which video but script shows them to be audio. And, some video files are completely skipped. I am giving the shell script below so that you can see. I am using two external files as source which I am attaching.


#Let's load the extensions that we want to search for
vdExt=$(cat vdExtList)
adExt=$(cat adExtList)


View 5 Replies View Related

Programming :: Bash Shell Read User Argument From Command Line And Test It

Aug 29, 2010

Trying to create a small script that will read user's input, test if user entered some input and if not display some message or display a text using user's input.

The script is the following but i get an error saying "[: 6: =: argument expected"

View 12 Replies View Related

Programming :: Finding A Shell Script To Delete Files Which Location Should Be Read From A Log File?

Jul 16, 2011

I have 2 external hdd in wich I have all my files.... yesterday, I have copied all the files from hdd2 to hdd1 and I want to eliminate duplicates so I used FSLint to find them, now, I have a txt file that looks like this:

Code: /media/My Book/!!!MIS DOCUMENTOS/Documentos/2 sep2003-jun2009 USB/!TESIS/TESIS/TESIS CVT LABVIEW Y CODEWARRIOR/LabVIEW85RuntimeEngineFull.exe /media/My Book/HDD_Toshiba/Borrable/Pen_Drive_4GB/Tesis/Super CD de la tesis/LabView/LabVIEW85RuntimeEngineFull.exe multiplied by millions of entries...

now I want to make a shell script to delete all the files/entries (read from the log file) that begin with:


/media/My Book/HDD_Toshiba/**** Since HDD_Toshiba is the folder in hdd1 (MyBook) that contains all the files from hdd2

View 1 Replies View Related

Ubuntu :: Shell, Auto Append Number To File And Read From External File?

Oct 31, 2010

cat ${SOURCE}/{start,universal,index,end}.txt > ${SERVER}/index.html
cat ${SOURCE}/{start,universal,02042010,end}.txt > ${SERVER}/02042010.html


View 3 Replies View Related

Programming :: Read Two Files Word By Word At A Time Using Any Loop By Shell Script?

Mar 4, 2010

Well, I am facing one issue:How can i read two files word by word at a time using any loop as i need word by word comparision in shell script?Please let me know pseudo code.

View 14 Replies View Related

General :: Read .gz File Direct On Shell/terminal Without Decompressing The File?

Dec 9, 2008

How can I read .gz file direct on shell/terminal without decompressing the file?

View 5 Replies View Related

Programming :: Bash Shell Script Read File Word By Word?

Jan 21, 2011

I have a output file look like this:
{"test1" : "test2", "test3" : "test4"},

How can I read word by word in each line?This is not working code:

while read word
do a=$(($a+1));


View 14 Replies View Related

Programming :: Implement Left-associative Operators In Parser That Does Not Allow Left Recursion?

Jan 20, 2011

The first is about implementing function calls. The way I currently have it is that functions are called with a C++ std::vector of nodes as the parameters. How would I turn a comma-seperated list of expressions into a C++ vector in the grammar?Second, how do you implement left-associative operators in a parser that does not allow left recursion?

And third, what would be the best internal representation of integers? A C++ int seems simplest, but limited. Using GMP seems more versatile, but I'm afraid it might seriously slow down the interpreter compared to C++ ints.

View 3 Replies View Related

Ubuntu :: 9.10 Not Allowing Telnet After A While?

Jan 12, 2010

I have a machine running Karmic and dovecot/postfix as a mail server.Everything is working fine with the mail system, except one thing. After sitting for a while I am unable to get to the server via telnet/pop3/smtp. Immediately after I ssh into the server to check it, these services start working.

View 9 Replies View Related

Ubuntu :: Pdf Reader Allowing To Set Colors?

Jan 2, 2011

I tried evince, okular and foxit reader for linux and wasn't able to change background and foreground colours with them. I'm able to do this with foxit reader for windows, so unless I find something that runs natively on ubuntu, I'll try running it under wine.

View 1 Replies View Related

Ubuntu Servers :: Allowing Connections From The Outside World Through SSH?

Jan 9, 2010

I want to set up my laptop to allow connections to certain users with passwords from anywhere over the internet via SSH but I'm unsure about how I would go about doing this. I only thought it would be the case of setting up the open-ssh server on the laptop then, using my external IP and PuTTY on another PC outside of the network, connect to the external IP through port 22 so I tried this and wait 3 or 4 minutes or so and it says the connection times out.

I have also configured my router to use port forwarding but this doesn't seem to help much either and I have LAMP setup to allow connections to external IP : 80. The only thing I am able to do is access the laptop through the local network by using its internal IP's like or something. I was wondering if anybody knows if and could tell me how I would do this as I really want to be able to access my home computer/laptop from my work sometimes, especially if I have work at home which is not with me at work or something.

I know this is possible but I'm quite new to this type of thing and don't know what is going wrong. Have I missed something or do I need to change any .conf files or anything?

View 4 Replies View Related

Ubuntu Installation :: 9.04 - Firefox Not Allowing To Update

Feb 27, 2010

I never use firefox because I use opera however I am really bored and I want to play around with my firefox however I have already ran into a problem, my problem is that firefox does not let me update to 3.6. I am currently using 3.0. How can I update my firefox? I use ubuntu 9.04.

View 5 Replies View Related

Ubuntu :: Allowing Apache To RW NTFS Mount

May 13, 2010

I keep my site files in an NTFS partition.When using Ubuntu, Apache gives me a forbidden 403 error when going to http://localhostI had this problem before, and if i remember correctly, to solve it I had to mount the hard drive as root when starting up, so I had this line in fstab:/dev/sda1 /media/Shared ntfs-3g quiet,defaults, locale=en_US.utf8,umask=000.But having that line there now doesn't make it work. It does mount Shared, and as root, but Apache still gives 403.

View 3 Replies View Related

Ubuntu Servers :: Snmp Not Allowing Outside Query

Aug 11, 2010

our 9.x servers are running perfect. Just setup 5 new webservers, running 10.04LTS. Have SNMPD running, installed and the same config for all the servers I just copied over, by config, I mean one line, that's it. So the servers have the following /etc/snmp/snmpd.conf file rocommunity public

That's it. Now the only difference is looking at the ps on the local box's, a working one shows;

snmp 1096 0.0 0.0 50480 3756 ? S Jul02 9:21 /usr/sbin/snmpd -Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid
where this one shows
snmp 4962 0.3 0.0 48540 5884 ? S 22:26 0:04 /usr/sbin/snmpd -Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid
Notice (I did flag it red) the local, but that co-incides with my


It almost seems something firewall is blocking, apparmor is not running, is there something else out of the box 10.04 has that I am just completly brain farting on?

View 1 Replies View Related

Ubuntu :: Allowing Incoming Connections On Port 22 From Anywhere?

Jul 19, 2011

I'm trying to get VNC working but I'm getting this error message:


ssh: connect to host my_ip_address port 22: Connection refused

When typing:


ssh -f -L 5900:localhost:5900 user@my_ip_address x11vnc -safer -localhost -nopw -once -display :0 && sleep 5 && vncviewer localhost:0

I'm trying to follow the instructions here: [URL] but I'm struggling with point 2 & 3:


2. If you have previously reconfigured the firewall on your PC, make sure the firewall allows incoming connections on port 22 from anywhere, and on port 5900 from localhost (also known as

3. If your PC is behind a home router, or any other device that uses NAT, configure your router to send connection attempts on port 22 (but not port 5900) to your PC

So my questions are:

1. I installed a fresh version of Ubuntu 11.4, should I be concerned about step 2? If so, how can I allow incoming connections on port 22 from anywhere, and on port 5900 from localhost?

2. Regarding step 3, I'm using NETGEAR model DGN1000 router. Is that something that I should do from the router's setting page or it's some commands that I should pass through SSH?

View 1 Replies View Related

Software :: Allowing Everything On Apache?

Sep 12, 2010

I am trying to get apache:asp to work on on apache2. I have everything installed but any folder I put a asp file in apache locks me out ofere is the error I get.?localhost?refused the connection. Is there a way I can get apache to allow everything? read write browse eveything. Then after I troubleshoot asp and get it working I will start working on security.

View 2 Replies View Related

Copyrights 2005-15 www.BigResource.com, All rights reserved