What, exactly, didn't work in bash? No reason it shouldn't be possible in it -- like any proper bourne shell, it's fully recursive, hence doesn't have mysterious corners where normal expressions don't work.
Quote:
I think csh is simpler.
It's not, really -- it just looks like it. When you start doing anything more complicated than "echo line", you find places it acts weird -- as you've already found. It's also unflexible, unportable, and widely loathed for a variety of technical faults to the point its own inventor admits he "wasn't too good at programming" when he wrote it. We even have our own FAQ about it.
More to the point, you need to know how to use a proper Bourne shell. Many important things in the system use bourne and only bourne shells.
Quote:
It even allows arguments, which I abuse, for aliases without needing to use a script.
Bash functions are way more powerful than aliases.
Put that in your ~/.bashrc and 'asdf' will be a command you can use.
But it also has aliases too. Show exactly what you tried in BASH and we'll find a way to make it work.
Read this entire thread, from the beginning, and that is all I tried with both csh and bash. This is what it comes down to:
Its purpose is to run a C++ program without trying to run the .cpp, .o, and other files. The C++ program will either be assign# or assign##, with the # being any arbitrary number. The alias works fine when I type it in (which is a pain), so I try the .bashrc file, but then the `` end up getting executed (like it did with the .cshrc file). This means it tries to find everything everywhere that qualifies for the regular expressions.
Maybe this can be solved with a function? Things in `` are still executed in the .bashrc file, whether they're in an alias or a function...
Was that clear enough? What I posted in this entire thread has everything and could be easier to understand.
(Also, in csh, I had a problems before with a $ being in the regular expressions. The details are on the previous thread page. I tried it with bash, and it worked fine. I suppose this is one of those csh problems.)
Read this entire thread, from the beginning, and that is all I tried with both csh and bash. Its purpose is to run a C++ program without trying to run the .cpp, .o, and other files.
You told us bits and pieces but never your entire purpose. Being clear would have helped you a lot.
find is going to give you a relative path. Just typing your script into the shell would've shown you that. Give find $HOME to fix that.
You also need to escape your $ so the shell doesn't think it's a variable. Trivial in BASH:
But you just can't make a literal $ appear inside double-quotes in CSH. It's another one of those annoying holes. You have to do something silly like
You should really narrow down find a lot more, too, or it's going to trawl your entire home directory, recursively, to find the one file that matches your grep regex, every time you run a shell.
tukuyomi: That finds them, yes, but I need to run them. Using `` (the backquotes) would accomplish this. However, if I use them in the .bashrc file (or in .cshrc), they are automatically run upon logging in.
Corona688: Using this in bash worked:
And that sparked an idea for me to make it work in csh (which is the default shell my university uses, sadly):
The \!* is not needed, but it could help with running something in a different directory.
And both ways work! Thanks for all your help, everyone. ^_^ Problem solved.
However, it makes me wonder... How might I set such variables in bash?
I'm trying to get some exclusions into our sendmail regular expression for the K command. The following configuration & regex works:
LOCAL_CONFIG
#
Kcheckaddress regex -a@MATCH
+<@+?\.++?\.(us|info|to|br|bid|cn|ru)
LOCAL_RULESETS
SLocal_check_mail
# check address against various regex... (0 Replies)
Hi All,
We have to copy some files from a source directory to a destination directory. We only have to copy the file if the filename is in a list of values.
We can use find command:
find . -type f -name '*_111.txt' -o -name '*_115.txt' ... -exec cp {} /tmp \;
But the list contains... (3 Replies)
How to do alternation using regular expressions in the 'find' command? Like say you want to find all files that do not match the names specifically "this" or "that" within a directory using regular expressions? (10 Replies)
Hello,
I want to check if directories exist with a regex expression
dir1=/temp/local/*/home (exists on file system)
dir2=/temp/server/*/logs (does not exist on file system)
I want to check if there are any directories with the above regex
Code:
if ];then
echo "Directory... (4 Replies)
Hi There,
Can anybody help me out for searching this regular expression?
xxxxx.yyy.zzzz.From-ABCD.To-XYZ.xxxxxx
I would like the ID1 and ID2 (knowing which one is Id1 and id2)
.From-<ID1>.
and
.To-<ID2>.
Thanks in advance!!
Regards,
Bhaskar (4 Replies)
Hi,
I need to find out the files whcih contains date in YYYYMMDD in their name.
I don't know if I can use regex in side find.
Now I am using commad for the same purpose which is not full proof.
find . -name "**" -print
But I want then It should contain at lease 8 digit in their... (3 Replies)
I have some files in unix
ls -1
TMH.backend.tar.421E-03.Z
TMH.backend.tar.421E-04.Z
TMH.backend.tar.421E-05.Z
TMH.backend.tar.421E-06.Z
TMH.backend.tar.421E-07.Z
TMH.backend.tar.421E-08.Z
TMH.backend.tar.421E-08.Z.bak20081223164844
TMH.backend.tar.421E-09.Z... (1 Reply)
I have a string which contains following information:
<SZ.T><P ALIGN="CENTER"><FONT FACE="Arial, Helvetica, sans-serif" SIZE="+3">Bundesregierung nimmt sich dicke Deutsche vor</FONT></P></SZ.T>
<SZ.UT><P ALIGN="CENTER"><FONT SIZE="+1"><I> Seehofer und Schmidt planen Kampagne gegen... (3 Replies)