Programming :: Bash: Regexp In 'if' Doesn't Evaluate Correctly

Mar 1, 2011

I'm using an 'if' statement to check whether one of positional arguments is a word or a construction like "x-y", but something doesn't seem right.

Here is the relevant part of the code:

Code:
if [[ "$3" =~ [a-Z]-[a-Z] || "$3" =~ [a-Z] ]]; then
grepRange=$3; else grepRange=$4
fi
And for the input like this:

[Code]....

but shouldn't the $grepRange variable be blank in this case?

Bash version is 4.1.7(1)

View 6 Replies


ADVERTISEMENT

Programming :: Bash Regexp String Compare Stopped Working?

Oct 20, 2010

Have a bash script which contains a line like this:

if [[ ${array[${last}]} =~ "screenpc.PRODUCTION.*" ]]

which WORKED as expected in bash 4.0.33 and now fails in 4.1.2

Instrumented the script to print the value of the left-hand side and it is exactly what is expected.

As noted above, this has been working fine until we installed Fedora 13 (kernel 2.6.33), and now it fails.

Tried setting shell 'extglob' to On with same results.

Did something change? Are there other shell/bash options that need to be set?this has the whole installation stopped!

View 10 Replies View Related

Ubuntu :: Regexp R-search In Bash

Jul 13, 2010

What keyboard shortcut will give me a regexp reverse search in bash? Or does C-r supply something like that already that I can't figure out?

View 4 Replies View Related

General :: Referance To The Bash Shell / Use The Test Command To Evaluate?

Nov 8, 2010

Cis 140 student.how to use the test command to evaluate whether the shell variable I create contains a referance to the bash shell? and use the echo command to determine the result.

View 1 Replies View Related

Ubuntu :: Bash ${variables} : Replace Last Instance Of Regexp?

Mar 10, 2011

I have something like...

Code:
var=beer
# echo ${var/%e/E} doesn't do anything because i can only replace "r" or "er" this way

[code]....

View 1 Replies View Related

Programming :: Migrate Regexp From SED To AWK?

Apr 22, 2010

I have a sed script to search and replace a pattern on the next kind of text:

Code:
C/username/Mydocuments/games & music
C/username/Mydocuments/New files 09-17-2007
C/username/settings
The script is:
code....

View 9 Replies View Related

Programming :: Script To Evaluate If A Passwd File Has Changed

Apr 6, 2010

creating a script which evaluates whether or not the passwd file has changed.

View 4 Replies View Related

Programming :: Write Regexp That Matches String That Begins With Whitespace Or Contains Newline?

Dec 10, 2010

How do I write a regexp that matches a string that begins with whitespace or contains a newline, but not necessarily both?

View 2 Replies View Related

Programming :: Inverse Regexp Matching / Developing Of An Idea 'pattern Based Filtration'?

Sep 3, 2010

I am interested in the following problem: given a string (pattern) find a regexp which match this pattern.
I will need this for a developing of an idea 'pattern based filtration'.

View 3 Replies View Related

Programming :: Bash: String Verifier Doesn't Work

May 26, 2011

I'm currently learning bash programming and am trying to create a program to maintain a list of people. Here is the code so far:

Code:

#!/bin/bash
# Namelist
clear

[code]....

As you can see, I attempted to build in a protective measure to prevent duplicate entries using "if grep -Fxq "$FN $LN" /home/andrea/namelist.txt", FN and LN being first name and last name as you can see in the first read operation. However, this fails to actually work. Demonstrations:

[URL]

It saves the details to the file rather than displaying the error message, or in other words, it doesnt check the file properly.

View 4 Replies View Related

Programming :: Sed Delete Lines From File One If Regexp Are Listed In File Two?

Sep 17, 2009

I am trying to delete lines of a file if they contain text that is present on another file. For example

> cat one.txt:

a
b
c
d

[code]....

I get the following output:

> ./test.sh one.txt two.txt
a
b
d
e

[code]....

View 6 Replies View Related

General :: Bash And Php Parsing / Not Getting The Data To Output Correctly Into The Rows?

Oct 26, 2010

i am trying to get a script that i'm calling to have information from a sql populate into rows... but i'm not getting the data to output correctly into the rows. can someone please help?

<table>
<thead>
<tr>
<th>Name</th>
<th>Help</th>
<th>Folder</th>
code....

View 14 Replies View Related

Ubuntu :: CUPS Bug: A4 Doesn't Print Correctly?

Jan 26, 2010

my printer has a known CUPS bug; A4 is printed as letter size; i.e. printing only appears on the bottom half of the page. I downloaded a ppd file at [URL] but it improved nothing. Also installed the bug's patch (sorry I don't have the bug's number) and followed the instructions; zero results. Upgraded Ubuntu 9.04's CUPS-related repositories to 9.10 but no improvement. Every test page still comes out with just the top third sitting at the bottom.

View 1 Replies View Related

Debian :: Dconf Write Doesn't Work Correctly

Oct 1, 2015

i installed debian 8.2 with gnome 3 desktop environment when i run this command

Code: Select alldconf write /org/gnome/nautilus/preferences/default-sort-order type i got this error

Code: Select allerror: 0-4:unknown keyword

Usage:

  dconf write KEY VALUE

Write a new value to a key

Arguments:
  KEY         A key path (starting, but not ending with '/')
  VALUE       The value to write (in GVariant format)

what should i do ?

also when i use gsettings i get

Code: Select all(process:4333): dconf-WARNING **: failed to commit changes to dconf: The connection is closed

View 6 Replies View Related

Fedora X86/64bit :: Doesn't Display Correctly Since Installing F10 X86-64

May 1, 2009

I have a laptop that doesn't display correctly since installing F10 x86-64. Instead of using the i810 driver, I see the experimental intel driver. I am running on a Dell D630 laptop with the default intel integrated graphics.

Just to note: Running gnome. I tried KDE and I can actually get this to work and display in 1600x1200. I don't want, "well use kde then" to be the solution. Also, in gnome, if I go to the screen resolution option from the menu, the mirron screens is clicked. Even when I detect monitors and unselect the mirror screens and pick the correct resolution, when I click OK, the screen flickers, and I go back to the same screen with the original default values? Wierd.

I got the bright idea to install system-config-display (something like that), which installed fine. I then changed my default resolution to 800x640 just to try it (really want 1600x1200). Well, I decided to reboot. Not the laptop doesn't start, it stops right after loading anaconda, and just won't go any further.

So two questions:

1. What do I need to change to get the laptop to actually boot?

2. How to get the external monitor to display in 1600x1200.

View 1 Replies View Related

Ubuntu :: Shortcut In Applications Menu Doesn't Run Correctly?

Apr 28, 2010

I've added Warsow.i386 (0.5) to my Applications > Games menu as a shortcut, but whenever I try to run it, my screen goes black for a second and then returns to desktop. Running the same file from its folder in /home runs the game fine.Is this common problem with shortcuts or is it just me and the game?

View 3 Replies View Related

Ubuntu :: Partition Doesn't Mount Correctly At Startup?

Aug 1, 2011

my "places menu" references folders on a second partion, where I store all my personal files (ntfs, as I use it also from Windows). After boot those folders wouldn't show in Thunar. Some other programs, as Fontmatrix, wouldn't find databases stored there, what messes them up. Thunderbird has problems to recognize profiles etc.What is strange, the partition seems to be mounted at startup as I can see and select it from Thunar. Also, it appears on Desktop. After selecting the partition, closing and reopening Thunar everything works fine, places would show correctly and Fontmatrix database is ok

View 2 Replies View Related

General :: Wine Doesn't Correctly Work / Resolve This?

Feb 15, 2011

I use Wine on Kubuntu 10.10.
Whenever some-application to open the Internet, wine browser is opened in loop untill I end process tree of wine server.
Also when I use it to execute .exe program I have error
e.g. I tried to run DriverGuide DriverScan:

Quote:

Component 'Codejock.DockingPane.v10.4.0.ocx' or one of its dependencies not correctly registered: a file is missing or invalid

Does anyone know whats missing ?

View 10 Replies View Related

Software :: Evince Doesn't Embed Correctly With Mozplugger

Apr 2, 2010

I have installed Mozplugger and changed mozpluggerrc so it opens evince. However, it shows an embedded version in the tab that doesn't accept interactions and opens the version that can be interacted with in a new window. Does anyone know what may be causing this? I'm not very knowledgable with the specific commands in mozpluggerrc.

My current setup for PDF files is as follows:

View 2 Replies View Related

Ubuntu :: Hibernation Doesn't Work Correctly After Upgrade To Lucid?

May 11, 2010

After the upgrade, I've noticed a problem I haven't had before - hibernating worked fine to the last. The problem is, although the system correctly hibernates, it makes no attempt to "wake" from hibernation when I power it up - it boots normally, and with fsck-ing like it was powered off without proper shutdown (understandably). I don't know why it happens, and I've skimmed the logs, but noticed nothing special. What could be the problem? What could I try? Which log should help someone find that out?

View 2 Replies View Related

General :: Flash Player Doesn't Display Correctly In Any Browser?

Mar 22, 2011

I'm running Kubuntu and have tested flash video sites with firefox, chromium and rekonq. I have installed all the available packages from Software Management but flash videos still don't display correctly. All get is a small rectangle of video on the bottom left hand side of the video box (which is otherwise grey).

View 4 Replies View Related

CentOS 5 :: Changing User Password Doesn't Work Correctly

Jan 20, 2011

My problem is that I cant "rewrite" older password to new. It looks like I do:

Changing password for user johny.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

all looks OK but after set up new password I can log in using OLD and NEW password. It's very unsecure for me. So in fact I cant change password and it looks like centos create next password to one accout and one account have more then one password... how can I prevent it? pls help me couse its very unsecure in my case.user looks in file shadow /etc/shadow like this:

johny:6JWuwPcQiWCCM:14994:0:99999:7:::

in etc/passwd looks like this:

johny:x:20010:20011::/home/gs-world:/sbin/nologin

how to delete all old passwords?

View 7 Replies View Related

Programming :: Bash: Printing The Line Number In Bash Script?

Feb 4, 2011

I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.

View 3 Replies View Related

Programming :: Bash Ctrl+c Tarp And Bash Read With Timeout?

Jan 24, 2010

simple bash code:

Code:
#!/bin/bash
trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c
echo "Press ctrl+c during 5 sec loop"
for ((i=0;i<5;i++)); do

[Code]...

How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!

View 10 Replies View Related

Ubuntu Installation :: 10.04 Terminal/Boot Splash Doesn't Display Correctly?

Apr 19, 2010

I just upgraded my computer from Ubuntu 9.10 to 10.04 (beta2) restarted and the splash was screwed i thought meh i can live with it then went into my account switched to tty1(ctrl+alt+F1) and it was the same. got annoyed now asking had anyone else encountered/know how to fix this problem. pictures attached sorry for bad quality took on phone, but that is how it really looks.

View 9 Replies View Related

Ubuntu Networking :: NFS Doesn't Mount Correctly - Network Manager And Upstart

Sep 25, 2010

I have the following problem: There are three NFS mounts in /etc/fstab, which are automatically mounted. The network connection runs over NetworkManager. Since NWM brings up the network asynchronously, NFS doesn't mount correctly on the first try, but is loaded soon enough since mount automatically retries until it works.

I can live with the fact that I have an error in my boot messages, since everything is up in time for the user. But, I need a (selfmade) upstart script which depends on the NFS mount being up. Even using "remote-filesystems" as the trigger doesn't help, because the trigger is apparently sent after the first failed try (I checked with cat /proc/mounts in my script, the nfs mounts are clearly not up.) Can I somehow force the remote mounts to wait until NWM is up, or make the NFS mount emit an event when the mounts really get mounted?

View 6 Replies View Related

Software :: Xclock Running From Start Script Doesn't Display Correctly?

Feb 21, 2011

I recently dist-upgraded from Debian 5 to 6 (squeeze). Since then, the xclock I run from my window manager's start script isn't displaying correctly (it displays only a "0"). The thing is, if I run the same command in my start script in my terminal, it works just fine, as it has always done...

I use this rather "old" X applications because I like my programs simple/not buggy/fast, and it's resulting a rather annoying problem (being that apparently nobody else has it...).
All other programs in my start script (gnome-terminal, emacs, xmodmap, etc) are working with no problems whatsoever.

My window manager: sawfish

Command to run xclock in my start script:

Code:
xclock -digital -brief -geometry -0+0
Attached picture:
Top: xclock initialized by start script
Bottom: xclock initialized by terminal

View 2 Replies View Related

Programming :: Reading A Bash Variable In Bash Scripting ?

Nov 26, 2008

I have a config file that contains:

my.config:

Code:

Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.

Here is my parse_cmd script:

Code:

View 3 Replies View Related

Programming :: Run Multiple Bash And Php Scripts From A Bash Script?

Jul 25, 2011

I have written quite a few separate bash & scripts and php scripts that up to now I have run from cron jobs. However I have to estimate how long each takes to run, before running the next and so it probably takes much longer than necessary to run them all. They have to run in order.

Now there are so many I am thinking it would be better to have a master bash script that would run one after the other, but I am not sure how to get the master script to wait before starting to run the next script. Is this possible and is there a command that will make the script wait between bash and php scripts , for them to finish, before running the next?

View 5 Replies View Related

Fedora Hardware :: HP Printer - HPLIP Driver In The Repo Doesn't Work Correctly

Apr 22, 2010

I recently had problems with my HP printer in Fedora 12, where as I never had a problem with it in any other distrubution.... For some reason, the HPLIP driver in the repo doesn't work correctly... I don't know why... but I kept getting errors with "error: Printer queue setup failed. Please restart CUPS and try again."

I tried every suggestion I found... which was installing extra dependencies, disabling firewall, disabling SELinux and a whole bunch of other stuff... but nothing worked... THEN finally I decided to use the HPLIP driver from the HP website... it was a .run file... and I executed it, and my printer has worked perfect eversince..... my question is.... has anybody successfully installed their hp printer from the hplip driver in the repo's..??? I don't know why it didn't work for me, and i've seen other fedora users complain of the same thing? maybe theres something wrong with the package? or its not pulling in a needed dependency? I don't know...

View 2 Replies View Related







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