Sponsored Content
Full Discussion: Bash Shell loop - Help !
Top Forums Shell Programming and Scripting Bash Shell loop - Help ! Post 302949737 by RudiC on Wednesday 15th of July 2015 11:45:03 AM
Old 07-15-2015
Please, don't post screen shots/pictures, as they can't be used for further analysis. Post code or result lines within code tags.

for (( i=W_NO; i>=W_NO; i--)) will execute exactly zero times, as the ending condition is immediatedly met. You may have had i>=0 in mind?
This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

bash and ksh: variable lost in loop in bash?

Hi, I use AIX (ksh) and Linux (bash) servers. I'm trying to do scripts to will run in both ksh and bash, and most of the time it works. But this time I don't get it in bash (I'm more familar in ksh). The goal of my script if to read a "config file" (like "ini" file), and make various report.... (2 Replies)
Discussion started by: estienne
2 Replies

2. Shell Programming and Scripting

problem with while loop in BASH shell

I have file named script1 as follows: #!/bin/bash count="0" echo "hello" echo "$count" while do echo "$count" count=`expr $count + 1` done ----------- when I run it, I get ./script1: line 9: syntax error near unexpected token `done' ./script1: line 9: `done' I... (6 Replies)
Discussion started by: npatwardhan
6 Replies

3. Shell Programming and Scripting

if loop not working in BASH shell

i have this code for a simple if loop: #!/bin/bash array="1 2 3 4 5" array2="5 6 7 8 9" if } -gt ${array} ]; then echo "${array2} is greater than ${array}!!" fi the error is ./script8: line 9: [: too many arguments ./script8: line 9: [: too many arguments ./script8: line 9: [:... (10 Replies)
Discussion started by: npatwardhan
10 Replies

4. UNIX for Dummies Questions & Answers

Anyone know?: How the 'for'-loop could stop working in interactive bash shell?!

It is happening with my sessions already second time: a 'for'-loop for some reason stop to work as expected. That means or it is looping without exitting, or it is not loop even once. Here example of my try when it is not processing even one loop. You can see, I start new subshell and... (14 Replies)
Discussion started by: alex_5161
14 Replies

5. Shell Programming and Scripting

How to use while loop in bash shell to read a file with 4 lines of gap

Hi , I am currently using the while loop in bash shell, as follows. while read line do echo $line done < file.txt However, i want to use the while loop on file.txt, which will read the file with 4 lines of gap. Ex- if file.txt is a file of 100 lines, then i want to use the loop such... (3 Replies)
Discussion started by: jitendriya.dash
3 Replies

6. Shell Programming and Scripting

Using variables created sequentially in a loop while still inside of the loop [bash]

I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends. As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

7. Shell Programming and Scripting

BASH loop inside a loop question

Hi all Sorry for the basic question, but i am writing a shell script to get around a slightly flaky binary that ships with one of our servers. This particular utility randomly generates the correct information and could work first time or may work on the 12th or 100th attempt etc !.... (4 Replies)
Discussion started by: rethink
4 Replies

8. Shell Programming and Scripting

Confusion about FOR LOOP syntax between Bourne and BASH shell. Please see.

for (( i=1; i<=3; i++ )); do for (( j=1; j<=3; j++ )); do for (( k=1; k<=3; k++ )); do echo $i$j$k done done done Will the above code work on a BOURNE shell? As far as my understanding is, if I am writing the above code in a file..say lol.sh and then running it through the terminal using... (7 Replies)
Discussion started by: navienavnav
7 Replies

9. Shell Programming and Scripting

"Command not found" doing a while loop in bash/shell

i=0 numberofproducts=${#urls} #gets number of entries in array called "urls" numberofproductsminusone=`expr $numberofproducts - 1` #-subtract by one while do wget ${urls} i=$(( $i + 1 )) sleep 10 done I'm getting an error ./scrape: line 22: [0: command not found that... (3 Replies)
Discussion started by: phpchick
3 Replies

10. UNIX for Dummies Questions & Answers

For loop in bash shell

Hi, I am using a for loop to manipulate files data_1.txt through data_100.txt. The for-loop is set up like this: for i in {1..100}; do cut -f1 data_$i.txt > output$i.txt I get the following error message when I run the code: cannot open `data.txt' for reading: No such file or directory... (4 Replies)
Discussion started by: evelibertine
4 Replies
VBETOOL(1)                                                         User Commands                                                        VBETOOL(1)

NAME
vbetool - run real-mode video BIOS code to alter hardware state SYNOPSIS
vbetool [[vbestate save|restore]|[vbemode set|get]|[vgamode]|[dpms on|off|standby|suspend|reduced]|[post [romfile]]|[vgastate on|off]|[vbefp panelid|panelsize|getbrightness|setbrightness|invert]] DESCRIPTION
vbetool uses lrmi in order to run code from the video BIOS. Currently, it is able to alter DPMS states, save/restore video card state and attempt to initialize the video card from scratch. OPTIONS
vbetool takes the following options: vbestate vbetool will use the VESA 0x4f0f extensions to save or restore hardware state. This will be sent to or read from stdin. This infor- mation is highly hardware specific - do not attempt to restore state saved from a different machine. This command will not work unless you are at a text console, as it interferes badly with X. dpms vbetool will use the VESA 0x4f10 extensions to alter the power management state of your screen. "On", "off", "standby", "suspend" and "reduced" are acceptable further options and determine which state will be activated. vbemode vbetool will get or set the current VESA mode. "get" will return the current mode number on stdout - "set" will set the mode to the next argument. vgamode vbetool will set the legacy VGA mode to the following numeric argument. post vbetool will attempt to run BIOS code located at c000:0003. This is the code run by the system BIOS at boot in order to intialise the video hardware. Note that on some machines (especially laptops), not all of this code is present after system boot - as a result, executing this command may result in undefined behaviour. This command must be run from a text console, as it will otherwise interfere with the operation of X. This command takes an optional argument which is the location of a file containing a ROM image. If provided, this image will be mapped to the c000 segment and used instead of the system's video BIOS. vgastate vbetool will enable or disable the current video card. On most hardware, disabling will cause the hardware to stop responding until it is reenabled. You probably don't want to do this if you're using a framebuffer. vbefp vbetool will execute a VESA flat panel interface call. panelid will provide information about the panel panelsize will provide the size of the panel getbrightness will provide the current screen brightness as an integer setbrightness accepts an integer as an argument and will set the screen brightness to that invert will invert the colours of the screen BUGS
Switching dpms modes may interact badly with X on some systems. The vbestate command may behave in strange ways. The post command may result in the execution of arbitrary code that happens to be lying around in the area where chunks of your video BIOS used to be. The VESA specification does not require that "vbemode get" provides the correct mode if the current mode was set via some means other than the VESA BIOS extensions. The VESA flat panel interface ceased development at the proposal stage. panelid and panelsize will work on many machines, but the other arguments are unlikely to be implemented on available hardware. AUTHOR
vbetool was written by Matthew Garrett <mjg59@srcf.ucam.org>, based on code from read-edid by John Fremlin <john@fremlin.de>, LRMI (http://sourceforge.net/projects/lrmi/) and XFree (http://www.xfree86.org). It is released under the terms of the GNU General Public License. vbetool 0.2 31 December 2004 VBETOOL(1)
All times are GMT -4. The time now is 08:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy