PLEX86  x86- Virtual Machine (VM) Program
 Plex86  |  CVS  |  Mailing List  |  Download  |  Linux  |  Newsgroups

Defining alias function with parameters


Your Ad Here

Your Ad Here

Unknown ssh connection to nonexistent IP
I just ran iptstate and it tells me: Source Destination Proto State TTL 192.168.0.6:1903 192.168.0.8:22 tcp ESTABLISHED 113:55:38 Here's the problem. 192.168.0.8...

On 2006-06-02, Thorsten Meininger

Aliases and functions are different animals. Note that the bash man pages says, "For almost every purpose, aliases are superseded by shell functions."

If you are going to put the entire thing on one line (not recommended, as it makes it harder to modify), you need a semi-colon before the closing brace:

fff() { find -name "$*" -type f -print; }

However, that function will not work if you pbutt more than one file name as an argument.

You should use:

fff() { find -name "$1" -type f -print }

man bash:

Special Parameters The shell treats several parameters specially. These parameters may only be referenced; buttignment to them is not allowed. * Expands to the positional parameters, starting from one. When the expansion occurs within double quotes, it expands to a sin- gle word with the value of each parameter separated by the first character of the IFS special variable. That is, "$*" is equiva- lent to "$1c$2c...", where c is the first character of the value of the IFS variable. If IFS is unset, the parameters are sepa- rated by spaces. If IFS is null, the parameters are joined without intervening separators. the expansion occurs within double quotes, each parameter expand to nothing (i.e., they are removed).

Neither will work in the function you defined.

Use the positional parameters, $1, $2, ...

-- Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) ===== My code in this post, if any, buttumes the POSIX locale ===== and is released under the GNU General Public Licence



Your Ad Here

List | Previous | Next

Unknown ssh connection to nonexistent IP

Linux groups from Newsgroups

The #1 Usenet Provider on the Internet

Help needed with Installin and Parbreastioning 1510