Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

SETLOCAL ... ALIAS ... pipes

May
12,845
164
I use global aliases. If in a BTM, I SETLOCAL and then define an alias, that alias is not known in pipes.

Is that WAD and is there a way around it?
 
WAD. SETLOCAL switches aliases from global to local, because users were complaining that when they modified an alias inside SETLOCAL it was affecting all of their sessions. Thus far, you're the only one who's *wanted* a change inside SETLOCAL to affect everything.

There is no way to turn that off.
 
It's not important. For years the text utils (grep, ...) from the ancient Thompson ToolKit have been in my PATH. They're simple and pretty easy to use and I'm quite accustomed to them. But I also have the (Gnu) UNXUTILS collection of tools which are significantly more powerful. I needed the Gnu utils in a project so I made some aliases to keep coding down. For example, these
Code:
alias gsort `(2>nul g:\gnu\sort.exe %$)`
alias gcut `g:\gnu\cut.exe %$`
alias guniq `g:\gnu\uniq.exe %$`
alias ggrep `g:\gnu\grep.exe %$`
made the likes of this
Code:
gcut -f 3 all.log | gsort -n | guniq -c | gsort -r | head /n %count
easier to code (and easier to read).
I was surprised when it didn't work inside SETLOCAL.

So, a question. If I (finally) move to a 64-bit OS, will things like the above still work with those 32-bit utilities?
 

Similar threads

Back
Top