It is known that attempting to invoke a custom alias inside itself (be it directly; or indirectly via intermediate aliases that call each other) would cause an "Alias loop." error, and rightfully so.
However, I would like to write a recursive csh alias, as I intend to include a base case to the recursion, so in my use case it is not an infinite loop. Here's a simplified example:
alias countdown 'if ( \!* > 0 ) then; echo \!*; countdown `expr \!* - 1`; endif;'
The expected output from this alias, for example with input 3, should be:
$ countdown 3
3
2
1
0
Attempting to define such an alias leads to the aforementioned "Alias loop." error on csh. How can I achieve this functionality correctly? I tried using a while loop in the alias instead of recursion, but it doesn't seem to be supported in csh, and other workarounds for this alias loop issue are not applicable since I do not have a built-in counterpart to invoke.
lstols -l. Can't you use a function or a little script instead?alias some_command='some_command --some-flag'which is a very basic use of aliases. So I guess a little script is the best way? (or just not using csh, of course :P)alias ls "ls -l", and why that works is explained in the accepted answer in the question I linked above