bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to save "$@", shift and reset $@ ?


From: gk
Subject: Re: how to save "$@", shift and reset $@ ?
Date: Thu, 29 May 2003 14:11:25 -0700

Thanks for the great ideas.
This does the trick for me:

#!/usr/local/bin/bash

echo num params=$#
saved=("$@")
echo 'set -- $saved'
set -- $saved
echo num params=$#

At 04:21 PM 5/29/2003 -0400, Paul Jarc wrote:
gk <gk@proliberty.com> wrote:
> I would like to save a copy of "$@" and reset it using 'set' command
> but cannnot figure out any way to inhibit evaluation of arguments to
> set.

A normal variable will not be able to store all the information needed
to restore $@.  You could use an array variable to store a copy of $@,
or you could use a shell function, which would run with its own
private $@.


paul

- Greg Keraunen
http://www.xmake.org





reply via email to

[Prev in Thread] Current Thread [Next in Thread]