Hmm, as fas as I remember `aliases' can't handle arguments, since they are inserted literally. If I need arguments I wrap the code into a function. At least the following example with alias didn't work in Bash and KSH:
I want to have an alias for the command
fold -78 filename | lp
How do I set my alias so that the argument passed is filename ??
alias lp='fold -78 | lp'
then
lp filename
wont work cuase this is
fold -78 | lp filename (1 Reply)
I've read the man on the alias command, and I am perplexed. I don't see a way to create an alias that will perform more than one command......is there a way to create an alias that is a string of a commands ? (1 Reply)
A good place to start is simple variable passing....
Passing variables from one script to another
The next level is passing a variable into a more complex command such as using a variable in a sed command. There are some simple quoting techniques that are very general. These are mentioned... (0 Replies)
Okay so I have an alias that looks like this:
ALIAS gscn {
MSG gscn Test1
MSG gscn Test2
MSG gscn Test3
MSG gscn Test4
MSG gscn Test5
}
How do I make it wait 5 seconds between each command before it executes the next one after that in order from top to bottom? I tried the TIMER... (1 Reply)
Hi, hope everyone are fine. Please find my issue below, and I request your help in the same
In a configuration file, i have a variable defined as below
TEST = 'One','Two','Three'
I am trying to pass this variable in to a sql script which is define in a pl/sql block
as follows,
In the... (1 Reply)
If one:
$ find -name 'some expression' -type f > newfile
and then subsequently wants to create an alias file from each pathname the find command retrieved and the > placed within 'newfile', how would one do this? Ideally, the newly created alias files would all be in one directory.
I am... (3 Replies)
the scenario is -
If I pass 3 three arguments( run time) , it should list all .txt files from a path to temp file
if I pass 2 arguments ( run time) , it should list all .csv files from the same path to another temp file
the above scenario should be handled in single code and also I dont know ... (2 Replies)
Hi Gurus,
Need some help with the shell scripting here.
#!/bin/ksh
ps -ef | grep -i sample.ksh | grep -v grep > abc.txt
if
then
echo "sample.ksh is executing"
else
echo "sample.ksh is not executing"
fi (1 Reply)
Hi,
I know with getopts you can pass arguments from the command line
./script -ab -c apple
But it doesn't support 2 or more arguments for ONE option. Is there any other way to do this?
Thanks (2 Replies)
Hi
I need to write a script to ssh through several hops (e.g. HostA-HostB-HostC-HostD), where Host A does not have direct assess to HostC ; HostB cannot access HostD directly.
when I ssh 3 hops and run command with arg1, arg2 and redirect the output to a file, e.g.
HostA> ssh -t HostB ssh -t... (3 Replies)
Discussion started by: chiensh
3 Replies
LEARN ABOUT OSF1
alias
alias(1) General Commands Manual alias(1)NAME
alias - Defines or displays aliases
SYNOPSIS
alias [-tx] [alias-name[=string...]]
Note
The C shell has a built-in version of the alias command. If you are using the C shell, and want to guarantee that you are using the com-
mand described here, you must specify the full path /usr/bin/alias. See the csh(1) reference page for a description of the built-in com-
mand.
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
alias: XCU5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
OPTIONS
[Tru64 UNIX] Sets or lists tracked aliases. [Tru64 UNIX] Sets or lists exported aliases.
Note
See the ksh(1) reference page for a description of tracked and exported aliases.
OPERANDS
Prints the alias definition on standard output. Assigns the value of string to the alias alias-name.
If no options and no operands are specified, all alias definitions are printed on standard output.
DESCRIPTION
The alias utility creates or redefines alias definitions or writes the values of existing alias definitions to standard output. An alias
definition provides a string value that replaces a command name when it is encountered.
An alias definition affects the current shell execution environment and the execution environments of the subshells of the current shell.
When used as described, the alias definition will not affect the parent process of the current shell nor any utility environment invoked by
the shell.
NOTES
[Tru64 UNIX] This reference page describes the creation and maintenance of aliases. See the Command Aliasing section of the ksh(1) or
sh(1p) reference pages for the description of alias substitution.
RESTRICTIONS
[Tru64 UNIX] If you use either the -t option or the -x option, you must use at least one alias-name or alias-name=string operand.
[Tru64 UNIX] Aliasing is performed when scripts are read, not while they are executed. Therefore, for an alias to take effect, the alias
definition command has to be executed before the command that references the alias is read.
[Tru64 UNIX] Aliases can be used to redefine special built-in commands but cannot be used to redefine the reserved words listed in the
ksh(1) reference page.
EXIT STATUS
The following exit values are returned: Successful completion. One of the name operands specified did not have an alias definition, or an
error occurred.
EXAMPLES
Change ls to give annotated output in columns: alias ls="ls -CF" Create a simple redo command to repeat previous entries in the command
history file: alias r='fc -s' Cause du to use 1K units instead of the default 512-bytes: alias du=du -k Set up nohup so that it can deal
with an argument that is itself an alias name: alias nohup="nohup "
ENVIRONMENT VARIABLES
The following environment variables affect the execution of alias: Provides a default value for the internationalization variables that are
unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari-
ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value,
override the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of
text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the format
and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MES-
SAGES.
SEE ALSO
Commands: csh(1), ksh(1), Bourne shell sh(1b), POSIX shell sh(1p), unalias(1)
Standards: standards(5)alias(1)