Wow! I have never encountered this before! Yet another reason to avoid csh. You must be using csh or tcsh as your shell. If you would switch to bash, you would not have this problem. But when csh sees an input line like "goto fubar", it will actually skip all further input lines until it encounters a line labeled "fubar". You can supply such an input line the first time. After that, another "goto fubar" sends it back to where it encountered the line labeled "fubar". Nice design...not.
I'm guessing that the "fubar:" line needs to be in the history list in order to loop, but I don't feel like testing that.
Hi,
I'm trying to use the goto in ksh but it does not appear to be a valid command. Is that only valid in csh? Anything similar in ksh that I can use?
Appreciate any help you can provide.
Thanks.
geraldine (4 Replies)
Hey Guys.. I just want to know how to use Goto statement in shell scripts.
I know the basic use of statement.
Goto Label
The above statement will search for some label which must be defined in the script itself as:
label:
I tried these combinations but I didn't work out for me and I'm... (7 Replies)
I have a test script for using goto statement but its not working. please help
i tried both in linux and hp-ux it's not working please help
#! /bin/ksh
t=`ps -ef|grep ti.sh|grep -v grep`
if ; then
goto start
else
goto stop
fi
start:
echo "start"
stop:
echo "stop" (5 Replies)
Dear All,
Can any one pls let me the command for how to goback to previous visited directory from the current working directory in SunOS ?
In case of HP-UX; the same can be resolved through "cd -" command.
Thanks in advance!
Prasanth Babu. (6 Replies)
Hello all,
I am in a terminal on Solaris and something weird is happening...
When I am typing I can't see what I am typing, although what I am typing is working. As is if I type the command and hit enter, the command runs.
Anyone have a clue why or how I can make it display my typing?
Is... (2 Replies)
Im trying to do something like this but I cant find any documentation.
read X
if
then goto ThisLine
fi
OTHER CODE
OTHER CODE
Label: ThisLine echo "You entered 1" (5 Replies)
Hi
As a dummy my question is very simple. When typing cw I've read (many times) that a '$' should appear at the end of the word I'm about to change. However, it doesn't, and in my case the word is instantly deleted and so ready to be changed!
Can somebody tell me why this is, or maybe I... (4 Replies)
H,
I
I have this below script for removing the full path from a string which is indeed a filepath location if windows.
It converts input
\abc\asssh\abc
To
abc
But if filename has 0 like:
\abc\abc\00000Hgg
Then its typing
abc00000Hgg
PLEASE note that its solaris.
Script is:
more... (10 Replies)
#!/bin/sh
label:
echo sql poll
v=`sqlplus -s <<!
HR/HR
set pages 0 echo off feed off
select distinct status from
emp
where
id=5;
!
`
echo $v;
echo it comes here after false
if
then
echo if condition true
sqlplus -l scott/tiger <<EOF
select * from department;
EXIT (2 Replies)
Well, guys I saw a question about GOTO for Python.
So this gave me the inspiration to attempt a GOTO function for 'dash', (bash and ksh too).
Machine: MBP OSX 10.14.3, default bash terminal, calling '#!/usr/local/bin/dash'...
This is purely a fun project to see if it is possible in PURE... (3 Replies)
Perl::Critic::Policy::RegularExpressions::ProhibitCapturUserhContributed PePerl::Critic::Policy::RegularExpressions::ProhibitCaptureWithoutTest(3)NAME
Perl::Critic::Policy::RegularExpressions::ProhibitCaptureWithoutTest - Capture variable used outside conditional.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
If a regexp match fails, then any capture variables ($1, $2, ...) will be undefined. Therefore it's important to check the return value of
a match before using those variables.
This policy checks that the previous regexp for which the capture variable is in-scope is either in a conditional or causes an exception or
other control transfer (i.e. "next", "last", "redo", "return", or sometimes "goto") if the match fails.
A "goto" is only accepted by this policy if it is a co-routine call (i.e. "goto &foo") or a "goto LABEL" where the label does not fall
between the "goto" and the capture variable in the scope of the "goto". A computed "goto" (i.e. something like "goto (qw{foo bar
baz})[$i]") is not accepted by this policy because its target can not be statically determined.
This policy does not check whether that conditional is actually testing a regexp result, nor does it check whether a regexp actually has a
capture in it. Those checks are too hard.
This policy also does not check arbitrarily complex conditionals guarding regexp results, for pretty much the same reason. Simple things
like
m/(foo)/ or die "No foo!";
die "No foo!" unless m/(foo)/;
will be handled, but something like
m/(foo) or do {
... lots of complicated calculations here ...
die "No foo!";
};
are beyond its scope.
CONFIGURATION
By default, this policy considers "die", "croak", and "confess" to throw exceptions. If you have additional subroutines or methods that may
be used in lieu of one of these, you can configure them in your perlcriticrc as follows:
[RegularExpressions::ProhibitCaptureWithoutTest]
exception_source = my_exception_generator
BUGS
This policy does not recognize named capture variables. Yet.
AUTHOR
Chris Dolan <cdolan@cpan.org>
COPYRIGHT
Copyright (c) 2006-2011 Chris Dolan.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.16.32014-06Perl::Critic::Policy::RegularExpressions::ProhibitCaptureWithoutTest(3)