You are not logged in.
I put the following in my bashrc, and resourced it. Then I could "see" the function with bash completion, but running it with "svnrev http://code.autistici.org/svn/fim" failed (-bash: http://code.autistici.org/svn/fim: No such file or directory). If I run the exact code in the function with $1 replaced with the address I just mentioned, it works fine.
function svnrev {
svn log $1 --limit 1 | sed -e '/^r/!d' -e 's/^r\([0-9]\+\) .*/\1/;q'
}
Any help appreciated
Offline
I tried it and it works.
the only thing I removed is the "q" at the end of the sed expression.
maybe you have another typo in your bashrc?
Offline
Nope, still not working even with removing the "q". I don't appear to have any spelling mistakes... hmph.
One other bash / function question, if I may stick it in here? How to I call a function in the middle of another function, explicitly? In other words...
pacmansoabc() { comm -3 <(pacman -Qq) <(pacman -Qqm); } # Give a list of installed packages sorted alphabetically
And then I want to make another function in the same file...
pacmanre() { pacman -S pacmansoabc; } # Reinstall all packages
Obviously, this makes pacman try to install the package "pacmansoabc". If I put "pacmansoabc" in backticks or $(), it complains that there is no such app.
EDIT: It appears that I had previously set svnrev to be an empty alias, and that never went away (apparently functions can't override aliases), so that was my problem. Huh. Still looking for info on the problem above
Last edited by Ranguvar (2009-06-15 23:53:03)
Offline
[jim@vaio vc3 ~]$ bash
[jim@vaio vc3 ~]$ fun1() { echo "one"; }
[jim@vaio vc3 ~]$ fun2() { echo "two"; echo $(fun1); }
[jim@vaio vc3 ~]$ fun2
two
one
[jim@vaio vc3 ~]$ exit
Are you sure your declaration of pacmansoabc is being sourced prior to, and visibly to, pacmanre? If they're both top-level declarations in your script, and pacmansoabc comes before pacmanre, it should be working.
EDIT: It occurred to me, your first function may be returning a multi-lined result, and then when you pass it to the second function, only the first line is used as an argument to pacman -S. The remaining lines the shell tries to execute as autonomous commands, and fails.
Try piping the results of the first command through xargs, or manipulate them to change the line breaks to spaces, or something like that.
Last edited by Profjim (2009-06-16 19:23:41)
Offline
That's probably it -- simple. Thanks!
Offline