Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Unexpected command/filename substitution ( caused by alias?) Post 302773357 by phil518 on Wednesday 27th of February 2013 06:44:21 PM
Old 02-27-2013
Unexpected command/filename substitution ( caused by alias?)

Hi:

there is a shell script, with the name "foo", located in a bin directory. in the same time, there is an alias "foo='/path/bin/foo' ", just for convenience.

in my home directory, there is a different script with name "foo" too. (a modified version.)

while in my home directory, when I do:

>$ cat foo

my local "foo" is displayed, as expected.

but if I do:
>$ source foo,

the common "/path/bin/foo" gets picked up, not my local one, as if the alias "foo" kicks in and substitutes the common "foo" for my local one.

to source my local "foo", I have to explicitly say:

>$ source ./foo

what I don't get is, the "foo" is the filename argument for both "cat" and "source" commands, but why the "foo" alias seemingly kicks in in "source" command, not the "cat" command.

Could any one shed some light on this?

Thanks.

NB Phil
 

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
SVK::Command::Patch(3)					User Contributed Perl Documentation				    SVK::Command::Patch(3)

NAME
SVK::Command::Patch - Manage patches SYNOPSIS
patch --ls [--list] patch --cat [--view] PATCHNAME patch --regen [--regenerate] PATCHNAME patch --up [--update] PATCHNAME patch --apply PATCHNAME [DEPOTPATH | PATH] [-- MERGEOPTIONS] patch --rm [--delete] PATCHNAME OPTIONS
--depot DEPOTNAME : operate on a depot other than the default one DESCRIPTION
To create a patch, use "commit -P" or "smerge -P". To import a patch that's sent to you by someone else, just drop it into the "patch" directory in your local svk repository. (That's usually "~/.svk/".) svk patches are compatible with GNU patch. Extra svk-specific metadata is stored in an encoded chunk at the end of the file. A patch name of "-" refers to the standard input and output. INTRODUCTION
"svk patch" command can help out on the situation where you want to maintain your patchset to a given project. It is used under the situation that you have no direct write access to remote repository, thus "svk push" cannot be used. Suppose you mirror project "foo" to "//mirror/foo", create a local copy on "//local/foo", and check out to "~/dev/foo". After you've done some work, you type: svk commit -m "Add my new feature" to commit changes from "~/dev/foo" to "//local/foo". If you have commit access to the upstream repository, you can submit your changes directly like this: svk push //local/foo Sometimes, it's useful to send a patch, rather than submit changes directly, either because you don't have permission to commit to the upstream repository or because you don't think your changes are ready to be committed. To create a patch containing the differences between "//local/foo" and "//mirror/foo", use this command: svk push -P Foo //local/foo The "-P" flag tells svk that you want to create a patch rather than push the changes to the upstream repository. "-P" takes a single flag: a patch name. It probably makes sense to name it after the feature implemented or bug fixed by the patch. Patch files you generate will be created in the "patch" subdirectory of your local svk repository. Over time, other developers will make changes to project "foo". From time to time, you may need to update your patch so that it still applies cleanly. First, make sure your local branch is up to date with any changes made upstream: svk pull //local/foo Next, update your patch so that it will apply cleanly to the newest version of the upstream repository: svk patch --update Foo Finally, regenerate your patch to include other changes you've made on your local branch since you created or last regenerated the patch: svk patch --regen Foo To get a list of all patches your svk knows about, run: svk patch --list To see the current version of a specific patch, run: svk patch --view Foo When you're done with a patch and don't want it hanging around anymore, run: svk patch --delete Foo To apply a patch to the repository that someone else has sent you, run: svk patch --apply - < contributed_feature.patch perl v5.10.0 2008-08-04 SVK::Command::Patch(3)
All times are GMT -4. The time now is 11:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy