Sponsored Content
Top Forums Shell Programming and Scripting Ksh riddle: interpret variable two times? Post 19409 by TioTony on Thursday 11th of April 2002 12:52:02 AM
Old 04-11-2002
Check out the "shift" command. I think it will do what you are looking for.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh: A part of variable A's name is inside of variable B, how to update A?

This is what I tried: vara=${varb}_count (( vara += 1 )) Thanks for help (4 Replies)
Discussion started by: pa3be
4 Replies

2. Shell Programming and Scripting

Riddle - solve it if you can

I don't understand this, can anyone explain the evaluation logic used here, and I would really appreciate a general explanation for it. ---------------------- Here's the korn script: -------------------- #! /usr/bin/ksh if ] then echo true else echo false fi if (( 2 > 10 )) then... (1 Reply)
Discussion started by: numstr
1 Replies

3. Shell Programming and Scripting

Can't interpret variable in if statement

Can someone help me out here. I can't get this piece of code to work. i.e. $ALL_EVENTS does not get interpreted in the if brackets. The first part is the code, the second part is the execution of the code. Note: $ALL_EVENTS does equal 2, but there is no value once passed to the if statement. ... (4 Replies)
Discussion started by: jwholey
4 Replies

4. Shell Programming and Scripting

KSH problem - how do i redirect three times?

i need to output an ls command to a file but also capture any errors from that command and output them to a log file and the screen. if it's only possible to output them to a log file and not the screen then that's fine. this is what i've tried so far, but it won't populate log.txt. i've... (16 Replies)
Discussion started by: mjays
16 Replies

5. UNIX for Dummies Questions & Answers

Output from who command - quick riddle

Hi all. So I have a problem. I have been doing real good figuring this stuff out on my own but Im a newbie and stuck on something that is probably real basic. I want to get the following output from the who command: User TTY Date Time gd22a12 pts/1 Feb 1 11:34 gd22a13 pts/3 Feb 1... (13 Replies)
Discussion started by: losingit
13 Replies

6. Shell Programming and Scripting

need help using one variable multiple times

I apologize for the title but I am not even sure myself what to call this. I am going to use an example of a pizza delivery. I need to make an interactive script that allows users to order a certain number of pizzas, and then choose what they want on each pizza. Here is my code so far.... ... (1 Reply)
Discussion started by: cstadnyk1
1 Replies

7. Shell Programming and Scripting

Tabbing a line a variable number of times in shell

Hi, I had another question. I was wondering if there was a way to tab a line a variable number of times in tcsh. To go into details, I want to tab a line by how deep a file is in its path. So here is an example code: set filea=/blah1/blah2/blah3 set fileb=/blah1/blah2/blah3/blah4 set... (4 Replies)
Discussion started by: chu816
4 Replies

8. Shell Programming and Scripting

Print one's place for 1 to N times, ksh Perl whatever?

Hello all, I would like to create a for loop or whatever is quick that will print the one’s place of a number for 1-N times say for example a printed page formatting is 132 characters wide, I would like a single line 123456789012345678901234567890... ...012 That is 132 characters long. I... (11 Replies)
Discussion started by: KmJohnson
11 Replies

9. UNIX for Dummies Questions & Answers

How do I count how many times a specific word appear in a file (ksh)?

Hi Please can you help how do I count the number of specific characters or words that appear in a file? (8 Replies)
Discussion started by: fretagi
8 Replies
shift(1)							   User Commands							  shift(1)

NAME
shift - shell built-in function to traverse either a shell's argument list or a list of field-separated words SYNOPSIS
sh shift [n] csh shift [variable] ksh * shift [n] DESCRIPTION
sh The positional parameters from $n+1 ... are renamed $1 ... . If n is not given, it is assumed to be 1. csh The components of argv, or variable, if supplied, are shifted to the left, discarding the first component. It is an error for the variable not to be set or to have a null value. ksh The positional parameters from $n+1 $n+1 ... are renamed $1 ..., default n is 1. The parameter n can be any arithmetic expression that evaluates to a non-negative number less than or equal to $#. On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari- able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not performed. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), ksh(1), sh(1), attributes(5) SunOS 5.10 15 Apr 1994 shift(1)
All times are GMT -4. The time now is 08:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy