Sponsored Content
Full Discussion: shift command
Top Forums Shell Programming and Scripting shift command Post 24881 by Nisha on Friday 19th of July 2002 05:54:32 AM
Old 07-19-2002
Hey Thanks!!!

Sounds like a good one..

Thanks,
Nisha
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

shift command

There is an error when i am trying to use the shift command in this way: ($1 = -d, $2 = 123, $3 = -c etc etc) for $arg in $@ do case $arg in "-d") shift; (so that the $2 will become the $arg now) (and while it loop the 2nd time,) ... (1 Reply)
Discussion started by: AkumaTay
1 Replies

2. UNIX for Dummies Questions & Answers

xterm SHIFT crazy

hi all, when I press SHIFT at once it work like as I've hold it (like CapsLock is On, but it Off) ! ... and if I press F1 (or another function key) it put out 24z :( it is occure on my remote sun 8 , xterm session help me please ! (2 Replies)
Discussion started by: oneivan
2 Replies

3. Shell Programming and Scripting

Regarding the shift command???

I am running a program where in I have this command which is giving error the shift: number is not correct. can you please tell me how shift actually works? the line which is giving error is- set $PARAM; shift; shift; shift; shift; shift; shift; shift; shift Is it related somewhere to... (2 Replies)
Discussion started by: shrao
2 Replies

4. UNIX for Dummies Questions & Answers

shift not working

Hi, I wrote one script, in between script needs to use 10th and 11th positional parameters, that time i used "shift". Here i am facing the below find problem, ./DataCount.sh: cannot shift I tried 1) I have read man pages for shift 2) Before but * and ** 3) Simple shift with out giving... (4 Replies)
Discussion started by: Nagapandi
4 Replies

5. Shell Programming and Scripting

AIX command to shift up

I would need the awk command or a better way to get my file that looks like 1234 5678 8912 3456 7890 to look like 1234,5678,8912,3456,7890 Thanks in advance (4 Replies)
Discussion started by: bombcan
4 Replies

6. UNIX for Dummies Questions & Answers

A Shift into UNIX

Hi, Firstly, I did a search for this question both on this site and on the internet and have not been able to find a suitable answer that is not general in nature. I have always been a Windows user. I use my girl friend's mac every now and then, but I always come back to windows. For a... (1 Reply)
Discussion started by: mearex
1 Replies

7. Shell Programming and Scripting

Use of Shift command

Hello Expert Can any one please explain what is the use of shift command in general terms: set -- $(ls -t) shift rm -Rf $* what is the use of shift command over here. Thanks a lot for your help (2 Replies)
Discussion started by: aks_1902
2 Replies

8. UNIX for Dummies Questions & Answers

can someone explain shift command in script?

think using shift would help me finish my script but cant get it work without your help. would appreciate if you give me a example with shift & counter in the same script so I can later work on that to my one. Thanks and Good Luck! (1 Reply)
Discussion started by: me.
1 Replies

9. Shell Programming and Scripting

AIX function example with "shift" command

Hello, I am reading one of the AIX manuals about shell scripting and (AIX 5) and I found this example when introducing to functions: function usage { prog="$1"; shift print -u2 "$prog: usage: $prog $@" exit 1 } This example is meant to be easy but I don't understand what it is... (5 Replies)
Discussion started by: Kibou
5 Replies

10. Shell Programming and Scripting

Shift command help

#!/bin/bash hostname=$1; shift for hostname in $1 do ping $hostname done I want to run the above script as hostname.sh yahoo.com google.com cnn.com. I want to shift each hostname to $1. How can do that with above code as currently it's not shifting. (5 Replies)
Discussion started by: scj2012
5 Replies
IO::Wrap(3)						User Contributed Perl Documentation					       IO::Wrap(3)

NAME
IO::Wrap - wrap raw filehandles in IO::Handle interface SYNOPSIS
use IO::Wrap; ### Do stuff with any kind of filehandle (including a bare globref), or ### any kind of blessed object that responds to a print() message. ### sub do_stuff { my $fh = shift; ### At this point, we have no idea what the user gave us... ### a globref? a FileHandle? a scalar filehandle name? $fh = wraphandle($fh); ### At this point, we know we have an IO::Handle-like object! $fh->print("Hey there!"); ... } DESCRIPTION
Let's say you want to write some code which does I/O, but you don't want to force the caller to provide you with a FileHandle or IO::Handle object. You want them to be able to say: do_stuff(*STDOUT); do_stuff('STDERR'); do_stuff($some_FileHandle_object); do_stuff($some_IO_Handle_object); And even: do_stuff($any_object_with_a_print_method); Sure, one way to do it is to force the caller to use tiehandle(). But that puts the burden on them. Another way to do it is to use IO::Wrap, which provides you with the following functions: wraphandle SCALAR This function will take a single argument, and "wrap" it based on what it seems to be... o A raw scalar filehandle name, like "STDOUT" or "Class::HANDLE". In this case, the filehandle name is wrapped in an IO::Wrap object, which is returned. o A raw filehandle glob, like "*STDOUT". In this case, the filehandle glob is wrapped in an IO::Wrap object, which is returned. o A blessed FileHandle object. In this case, the FileHandle is wrapped in an IO::Wrap object if and only if your FileHandle class does not support the "read()" method. o Any other kind of blessed object, which is assumed to be already conformant to the IO::Handle interface. In this case, you just get back that object. If you get back an IO::Wrap object, it will obey a basic subset of the IO:: interface. That is, the following methods (note: I said methods, not named operators) should work on the thing you get back: close getline getlines print ARGS... read BUFFER,NBYTES seek POS,WHENCE tell NOTES
Clearly, when wrapping a raw external filehandle (like *STDOUT), I didn't want to close the file descriptor when the "wrapper" object is destroyed... since the user might not appreciate that! Hence, there's no DESTROY method in this class. When wrapping a FileHandle object, however, I believe that Perl will invoke the FileHandle::DESTROY when the last reference goes away, so in that case, the filehandle is closed if the wrapped FileHandle really was the last reference to it. WARNINGS
This module does not allow you to wrap filehandle names which are given as strings that lack the package they were opened in. That is, if a user opens FOO in package Foo, they must pass it to you either as "*FOO" or as "Foo::FOO". However, "STDIN" and friends will work just fine. VERSION
$Id: Wrap.pm,v 1.2 2005/02/10 21:21:53 dfs Exp $ AUTHOR
Primary Maintainer David F. Skoll (dfs@roaringpenguin.com). Original Author Eryq (eryq@zeegee.com). President, ZeeGee Software Inc (http://www.zeegee.com). POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 212: '=item' outside of any '=over' perl v5.16.2 2005-02-10 IO::Wrap(3)
All times are GMT -4. The time now is 02:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy