Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Unexpected command/filename substitution ( caused by alias?) Post 302773693 by Don Cragun on Thursday 28th of February 2013 01:43:16 PM
Old 02-28-2013
The cat utility is being asked to read a file; the source utility is being asked to execute a file. When you execute a file, lots of additional processing is invoked to find the file to be executed (alias searches, $PATH searches, ...) that is not done when you are just reading a file.
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

alias for rm command

Hi, i want to make alias for rm command. It should actually move the file to a directory in my home. Say if i type %rm abc.txt the command should expand to %mv abc.txt ~ashishp/trash How should I write the alias for this? -Ashish (8 Replies)
Discussion started by: shriashishpatil
8 Replies

2. UNIX for Dummies Questions & Answers

why emacs caused "command not found" error

I installed Red Hat Enterprise Linux 5 on my PC. When i typed 'emacs' on the console, "command not found" error occurrd. Why. :mad: (1 Reply)
Discussion started by: cy163
1 Replies

3. Shell Programming and Scripting

syntax error near unexpected token...what caused?

Dear all, When I tried to run receive.sh,it returned following errors. syntax error near unexpected token `do #!/usr/bin/ksh GlobalValueReceive=r GlobalValueWorking=w GlobalValueTemp=t $exec 0<Property while read LineInProperty do if then $GlobalValueReceive =... (8 Replies)
Discussion started by: joshuaduan
8 Replies

4. UNIX for Advanced & Expert Users

Alias a command

Hi 'm executing a java program from my shell script on solaris 9 as $JAVA_HOME\bin\java -ms32m -mx128m -classpath $CLASSPATH com.abc.fwk,abcServer.abcfwkServer $1 & where $1 is port number when i do ps -ef, it shows whole command , i want to give this some alias name as abcProcess, so... (2 Replies)
Discussion started by: b_garima
2 Replies

5. UNIX for Dummies Questions & Answers

Parameter substitution with alias

Hello, in my .bashrc I tried to setup some aliases. alias scp_cmd="scp -P 8888 $1 me@somehost:." is supposed to copy a local file to somehost via scp. However it seems that the command line substitution does not work here. However this works: alias lst="ls -l $1" The above scp command can... (1 Reply)
Discussion started by: strobotta
1 Replies

6. Shell Programming and Scripting

Substitution in a file dont work with an Array in filename

Hi. I´ve a script that should substitude the 8th line in a file called xxx.num6. The "xxx" is set by an array filled with this command: j=0 for Par in *.sys ; do Par=`echo $Par | sed 's/\(.*\).sys/\1/'` ; Par2="$Par" ; echo "${Par2}" j=$((j + 1)); done Now i try... (0 Replies)
Discussion started by: Lock3
0 Replies

7. UNIX for Dummies Questions & Answers

sed insert command and variable expansion/command substitution

I know this script is crummy, but I was just messing around.. how do I get sed's insert command to allow variable expansion to show the filename? #!/bin/bash filename=`echo $0` /usr/bin/sed '/#include/ { i\ the filename is `$filename` }' $1 exit 0 (8 Replies)
Discussion started by: glev2005
8 Replies

8. UNIX for Dummies Questions & Answers

the meaning of "!:*" in "alias foo 'command\!:*' filename"

Hi: How can I remove my own post? Thanks. (2 Replies)
Discussion started by: phil518
2 Replies

9. UNIX for Dummies Questions & Answers

read command - using output from command substitution

Hey, guys! Trying to research this is such a pain since the read command itself is a common word. Try searching "unix OR linux read command examples" or using the command substitution keyword. :eek: So, I wanted to use a command statement similar to the following. This is kinda taken... (2 Replies)
Discussion started by: ProGrammar
2 Replies

10. Shell Programming and Scripting

Alias command help

Hello, I'm attempting to configure shell settings in my new Macbook. The standard unix command line 'alias' doesn't seem to be working: bash-3.2$ alias dir ls -la bash: alias: dir: not found bash: alias: ls: not found bash: alias: -la: not found bash-3.2$ alias dir 'ls -la' bash:... (1 Reply)
Discussion started by: palex
1 Replies
alias(1)							   User Commands							  alias(1)

NAME
alias, unalias - create or remove a pseudonym or shorthand for a command or series of commands SYNOPSIS
/usr/bin/alias [ alias-name [ = string...]] /usr/bin/unalias alias-name... /usr/bin/unalias -a csh alias [ name [def]] unalias pattern ksh alias [-tx] [ name [ = value]...] unalias name... unalias [-a] DESCRIPTION
The alias and unalias utilities create or remove a pseudonym or shorthand term for a command or series of commands, with different func- tionality in the C-shell and Korn shell environments. /usr/bin/alias 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 specified by this document, the alias definition will not affect the parent process of the current shell nor any utility envi- ronment invoked by the shell. /usr/bin/unalias The unalias utility removes the definition for each alias name specified. The aliases are removed from the current shell execution environ- ment. The -a option removes all alias definitions from the current execution environment. csh alias assigns def to the alias name. The assigned def is a list of words that may contain escaped history-substitution metasyntax. name is not allowed to be alias or unalias. If def is omitted, the alias name is displayed along with its current definition. If both name and def are omitted, all aliases are displayed. Because of implementation restrictions, an alias definition must have been entered on a previous command line before it can be used. unalias discards aliases that match (filename substitution) pattern. All aliases may be removed by `unalias *'. ksh alias with no arguments prints the list of aliases in the form name=value on standard output. An alias is defined for each name whose value is given. A trailing space in value causes the next word to be checked for alias substitution. The -t flag is used to set and list tracked aliases. The value of a tracked alias is the full pathname corresponding to the given name. The value becomes undefined when the value of PATH is reset but the aliases remained tracked. Without the -t flag, for each name in the argument list for which no value is given, the name and value of the alias is printed. The -x flag is used to set or print exported aliases. An exported alias is defined for scripts invoked by name. The exit status is non-zero if a name is given, but no value, and no alias has been defined for the name. The aliases given by the list of names may be removed from the alias list with unalias. OPTIONS
The following option is supported by unalias: -a Removes all alias definitions from the current shell execution environment. ksh The following option is supported by alias: -t Sets and lists tracked aliases. OPERANDS
The following operands are supported: alias alias-name Write the alias definition to standard output. unalias alias-name The name of an alias to be removed. alias-name=string Assign the value of string to the alias alias-name. If no operands are given, all alias definitions will be written to standard output. OUTPUT
The format for displaying aliases (when no operands or only name operands are specified) is: "%s=%s " name, value The value string will be written with appropriate quoting so that it is suitable for reinput to the shell. EXAMPLES
Example 1: Modifying a command's output This example specifies that the output of the ls utility is columnated and more annotated: example% alias ls="ls -CF" Example 2: Repeating previous entries in the command history file This example creates a simple "redo" command to repeat previous entries in the command history file: example% alias r='fc -s' Example 3: Specifying a command's output options This example provides that the du utility summarize disk output in units of 1024 bytes: example% alias du=du -k Example 4: Dealing with an argument that is itself an alias name This example sets up the nohup utility so that it can deal with an argument that is itself an alias name: example% alias nohup="nohup " ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of alias and unalias: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 0 Successful completion. alias >0 One of the alias-name operands specified did not have an alias definition, or an error occurred. unalias >0 One of the alias-name operands specified did not represent a valid alias definition, or an error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), ksh(1), shell_builtins(1), attributes(5), environ(5), standards(5) SunOS 5.10 17 Jul 2002 alias(1)
All times are GMT -4. The time now is 05:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy