Sponsored Content
Full Discussion: -ne 0 doesn't work -le does
Top Forums Shell Programming and Scripting -ne 0 doesn't work -le does Post 302945897 by ab_2010 on Thursday 4th of June 2015 12:32:14 PM
Old 06-04-2015
-ne 0 doesn't work -le does

Hi,

I am using korn shell.

Code:
until [[ $# -ne 0 ]]
do
echo "\$# = " $#
echo "$1"
shift
done

To the above script, I passed 2 parameters and the program control doesn't enter inside "until" loop. If I change it to until [[ $# -le 0 ]] then it does work.

Why numeric comparison is not working with -ne and works with -le?

thank you

Last edited by Scrutinizer; 06-04-2015 at 01:42 PM.. Reason: code tags
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Why doesn't this work?

cat .servers | while read LINE; do ssh jason@$LINE $1 done exit 1 ./command.ksh "ls -l ~jason" Why does this ONLY iterate on the first server in the list? It's not doing the command on all the servers in the list, what am I missing? Thanks! JP (2 Replies)
Discussion started by: jpeery
2 Replies

2. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

3. Shell Programming and Scripting

ls -d doesn't work on Solaris

Hello, the ls -d command to only list directories in a directory doesn't seem to work on Solaris and the man command says to use that combination: ls -d Anyone have the same problem and find a resolve? Thanks BobK (9 Replies)
Discussion started by: bobk544
9 Replies

4. UNIX for Dummies Questions & Answers

lp -o <option> doesn't work

why lp -o <option> doesn't work on my SCO Unix. (4 Replies)
Discussion started by: wendyz
4 Replies

5. Shell Programming and Scripting

awk -v -- Why doesn't my example work?

Hi. I've been playing around a bit. This isn't for any practical purpose-- it's really just a theoretical exercise. I wrote this little thing: foreach num ( 6 5 4 ) awk -v "number=$num" 'BEGIN{for(x=0;x<$number;x++) printf "-"; printf "\n"}' end I would expect the following output: ... (3 Replies)
Discussion started by: treesloth
3 Replies

6. Shell Programming and Scripting

alias doesn't work

Hi I have put alias ll='ls -la' in .profile file but it doesn't work. On hand it works it looks like the .profile file is not beeing read. How to check whitch file is loaded? ,profile? .bash_profile? My system: SunOS mion 5.10 Generic Shell: /bin/pfksh Thanks (2 Replies)
Discussion started by: miojamo
2 Replies

7. Shell Programming and Scripting

if condition doesn't work

i want to get the value for column 4rth when i =4. please guide what i am doing wrong. thanks var=`cat file.csv` for i in $var; do { if ; then var4=$var4+$i fi echo $i } done I am geting this error message "0403-009 The specified number is not valid for this command." (8 Replies)
Discussion started by: sagii
8 Replies

8. UNIX for Dummies Questions & Answers

Why doesn't this work?

find . -name "05_scripts" -type d -exec mv -f {}/'*.aep\ Logs' {}/.LogFiles \; Returns this failure: mv: rename ./019_0120_WS_WH_gate_insideTEST/05_scripts/*.aep\ Logs to ./019_0120_WS_WH_gate_insideTEST/05_scripts/.LogFiles/*.aep\ Logs: No such file or directory I don't know why it's trying... (4 Replies)
Discussion started by: scribling
4 Replies

9. HP-UX

Sudo doesn't work

I edited sudoers like this:vi /etc/sudoers subex ALL =(root) NOPASSWD: /usr/ccs/bin/pstack But the respective user still is prompted for password, and even when the right password is used, the command is still not launched.$sudo usr/ccs/bin/pstack 26557 We trust you have received the usual... (5 Replies)
Discussion started by: black_fender
5 Replies
Test::Inline::Content::Legacy(3pm)			User Contributed Perl Documentation			Test::Inline::Content::Legacy(3pm)

NAME
Test::Inline::Content::Legacy - Test::Inline 2 Content Handler for legacy functions SYNOPSIS
Custom script content generation using Test::Inline 2.000+ with a custom generator functions my $header = "...."; my $function = sub { my $Object = shift; my $Script = shift; return $header . $Script->merged_content; }; my $Inline = Test::Inline->new( ... file_content => $function, ); Migrating this same code to Test::Inline 2.100+ ContentHandler objects my $header = "...."; my $function = sub { my $Object = shift; my $Script = shift; return $header . $Script->merged_content; }; my $ContentHandler = Test::Inline::Content::Legacy->new( $function ); my $Inline = Test::Inline->new( ... ContentHandler => $ContentHandler, ); DESCRIPTION
This class exists to provide a migration path for anyone using the custom script generators in Test::Inline via the "file_content" param. The synopsis above pretty much says all you need to know. METHODS
new $CODE_ref The "new" constructor for "Test::Inline::Content::Legacy" takes a single parameter of a "CODE" reference, as you would have previously provided directly to "file_content". Returns a new "Test::Inline::Content::Legacy" object, or "undef" if not passed a "CODE" reference. coderef The "coderef" accessor returns the "CODE" reference for the object process $Inline $Script The "process" method works with the legacy function by passing the Test::Inline and Test::Inline::Script arguments straight through to the legacy function, and returning it's result as the return value. SUPPORT
See the main SUPPORT section. AUTHOR
Adam Kennedy <adamk@cpan.org>, <http://ali.as/> COPYRIGHT
Copyright 2004 - 2010 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.12.4 2010-11-22 Test::Inline::Content::Legacy(3pm)
All times are GMT -4. The time now is 10:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy