Sponsored Content
Top Forums Shell Programming and Scripting Case statement not working as expected Post 302785973 by Michael Stora on Tuesday 26th of March 2013 03:24:34 PM
Old 03-26-2013
Case statement not working as expected

Code:
            case "$freq" in
            [2,2.5,3.15,4,5,6.3]" Hz")          low=250; high=550;;
            "8 Hz")                             low=250; high=1000;;
            [10,12.5,16,20,25,31.5,40,50]" Hz") low=400; high=1000;;
            "63 Hz")                            low=550; high=1000;;
            [80,100,125,160,200,250]" Hz")      low=400; high=550;;
            *)                                  low=error; high=error;;
            esac

The strings containing decimal places like "6.3 Hz" are not being found in the case statement. I have tried putting "6.3" or '6.3' around the individual entries.

Can someone explain what is going on here?

Mike
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

case statement

Hi all, is it possible to create a 'dynamic' case statement. ie select option in `ls` do case satement depending on results of the above `ls` done I hope I have explained this ok! Thanks Helen (1 Reply)
Discussion started by: Bab00shka
1 Replies

2. Shell Programming and Scripting

which not working as expected

Hello. Consider the following magic words: # ls `which adduser` ls: /usr/sbin/adduser: No such file or directory # Hmmm... Then: # ls /usr/sbin/adduser /usr/sbin/adduser # Now what? Unforunately this little sniippet is used in my debian woody server's mysql pre install script.... (2 Replies)
Discussion started by: osee
2 Replies

3. UNIX for Dummies Questions & Answers

CASE statement

Hi, I am writing a bash shell script. My script has a few user defined parameters. When the script runs the first thing it does is make sure that these parameters are valid. One of the parameters is called YEAR. A valid input for YEAR can be 1997-2000. One way I have come up with to ensure... (3 Replies)
Discussion started by: msb65
3 Replies

4. Shell Programming and Scripting

case statement

Hi, I am writing case statement to execute some finction, my requirement is once one of the case statement is executed again it has to prompt for the option. for script in `echo "$Script_Selected"` do case $script in 1) getNoOFActUsers ;; 2) moveServerrOORotation ;; ... (2 Replies)
Discussion started by: Satyak
2 Replies

5. Shell Programming and Scripting

Why this is not working in expected way?

total=0 seq 1 5 | while read i ; do total=$(($total+$i)) echo $total done echo $totalThis outputs: 1 3 6 10 15 0whereas I am expecting: 1 3 6 10 15 15My bash version: (4 Replies)
Discussion started by: meharo
4 Replies

6. Shell Programming and Scripting

awk is Printing folders with only numbers as expected. But can't explain 'total' statement.

I am trying to get folder names that contain only numbers. Can someone explain why following command is printing 'total 450' as part of output.. $> ls -lt | awk '$9 ~ /^*$/' | more total 450 drwxr-x--x 3 user1 group1 512 Mar 9 2008 329227163 drwxr-x--x 3 user1 group1 ... (17 Replies)
Discussion started by: kchinnam
17 Replies

7. Shell Programming and Scripting

Case statement

Hello, The standard case statement :- case "$1" in "IE0263") commands;; "IE0264") commands;; esac is it possible to have :- case "$1" in "IE0263" OR "IE0878") commands;; "IE0264") commands;; esac Thanks (4 Replies)
Discussion started by: jmahal
4 Replies

8. Shell Programming and Scripting

If statement with [[ ]] and regex not working as expected

Using BASH: $ if -- ::00" ]]; then echo "true"; else echo "false"; fi false Mike (5 Replies)
Discussion started by: Michael Stora
5 Replies

9. Shell Programming and Scripting

If statement fails with integer expression expected

Below is what i have in my script. htcount=$(curl -s --user tomcatstatus:tomcatstatus http://`hostname`.mypc.com:887/manager/jmxproxy?qry=Catalina:type=ThreadPool,name=\"http-nio-887\" |grep sBusy | cut -d ' ' -f2) echo $htcount if ; then echo "more than 10" else echo "Less than 10" fi... (6 Replies)
Discussion started by: mohtashims
6 Replies

10. Shell Programming and Scripting

Bash read input in case statement not working as expected

I'm having an issue with bash read input when using a case statement. The script halts and doesn't read the input on the first loop. if I hit enter then the scripts starts to respond as expected. Need some help here. defaultans=8hrs read -e -i $defaultans -p "${bldwht}How long would you like... (5 Replies)
Discussion started by: woodson2
5 Replies
fb.modes(5)						     Linux frame buffer utils						       fb.modes(5)

NAME
fb.modes - frame buffer modes file DESCRIPTION
/etc/fb.modes contains an unlimited number of video mode descriptions. The general format of a video mode is: mode geometry <xres> <yres> <vxres> <vyres> <depth> timings <pixclock> <left> <right> <upper> <lower> <hslen> <vslen> options <value> rgba <red,green,blue,alpha> endmode OPTIONS
geometry options: xres visible horizontal resolution (in pixels) yres visible vertical resolution (in pixels) vxres virtual horizontal resolution (in pixels) vyres virtual vertical resolution (in pixels) depth display depth (in bits per pixel) timing options: pixclock length of one pixel (in picoseconds) left left margin (in pixels) right right margin (in pixels) upper upper margin (in pixel lines) lower lower margin (in pixel lines) hslen horizontal sync length (in pixels) vslen vertical sync length (in pixel lines) rgba options (only valid with truecolor): red red color bitfields (in length or length/offset) green green color bitfields (in length or length/offset) blue blue color bitfields (in length or length/offset) alpha alpha color bitfields (in length or length/offset) other options: the first value of this options is the default hsync {low|high} the horizontal sync polarity vsync {low|high} the vertical sync polarity csync {low|high} the composite sync polarity gsync {low|high} the sync on green polarity bcast {false|true} enable or disable broadcast modes. If enabled the frame buffer generates the exact timings fot several broadcast modes (e.g. PAL or NTSC). Note that this option may not be supported by every frame buffer extsync {false|true} enable or disable external resync. If enabled the sync timings are not generated by the frame buffer device and must be pro- vided externally instead. Note that this option may not be supported by every frame buffer device laced {false|true} enable or disable interlace. If enabled the display will be split in two frames, each frame contains only even and odd lines respectively. These two frames will be displayed alternating, this way twice the lines can be displayed and the vertical fre- quency for monitor stays the same, but the visible vertical frequency gets halved double {false|true} enable or disable doublescan. If enabled every line will be displayed twice and this way the horizontal frequency can easily be doubled, so that the same resolution can be displayed on different monitors, even if the horizontal frequency specifica- tion differs. Note that this option may not be supported by every frame buffer device nostd <number> select nonstandard video mode accel {false|true} enable or disable hardware text acceleration grayscale {false|true} enable or disable graylevels instead of colors INTERNALS
Generally a frame buffer display is organized as follows: +---+---------------+---+---+ | | ^ | | | | | | 5 | | | | | v | | | +---#################---+---+ | # ^ # | | | # | # | | | # | # | | | 1 # | 2 # 3 | 4 | |<->#<------+------>#<->|<->| | # | # | | | # | 6 # | | | # | # | | | # v # | | +---#################---+---+ | | ^ | | | | | | 7 | | | | | v | | | +---+---------------+---+---+ | | ^ | | | | | | 8 | | | | | v | | | +---+---------------+---+---+ 1 left margin 2 xres 3 right margin 4 horizontal sync len 5 upper margin 6 yres 7 lower margin 8 vertical sync len The area bordered with `#' is the visible display area. Horizontal and vertical frequencies can now easily be calculated, for this the sum of horizontal or vertical values are important htotal = left + xres + right + hslen vtotal = upper + yres + lower + vslen The length of one line can now be calculated with pixclock line = pixclock * htotal and we have the horizontal frequency hfreq = 1E12 / line = 1E12 / (pixclock * htotal) To get the vertical frequency vtotal must eventually adjusted. If the display is laced, vtotal must be halved or if the display is a dou- blescan one, vtotal must be doubled. Now we can calculate the length of one frame if (lace) vtotal /= 2 if (double) vtotal *= 2 frame = vtotal * line and we get also the vertical frequency vfreq = 1E12 / frame = hfreq / vtotal SEE ALSO
fbset(8), fbdev(4) 2.1 2003-08-07 fb.modes(5)
All times are GMT -4. The time now is 05:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy