Blade3 Blade3 - 1 year ago 202
Linux Question

Convert .cshrc to .bashrc

I am new to Linux and I am trying to compile some code that needs environment variables set first. The script is in cshrc, but whenever I try to run that code I get "if: badly formed number" errors. I want to run it in bash instead. Is there an easy way to convert cshrc to bashrc?

Answer Source

Yes, post the code. There are hordes of alpha geeks just waiting here to do this sort of work for you, sort of like Rent A Coder but without the cost :-)

Seriously, it's likely to be just the fact that, from memory, csh uses parentheses for conditions while bash uses [[...]] but, until you post the code (at least the offending lines with some context), we can't be sure.

In other words, the csh:

if ($number < 0) then
    echo What the ...

would become the bash:

if [[ $number -lt 0 ]] ; then
    echo What the ...
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download