Skip to content
Advertisement

Convert .cshrc to .bashrc [closed]

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?

Advertisement

Answer

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 ...
endif

would become the bash:

if [[ $number -lt 0 ]] ; then
    echo What the ...
fi
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement