Skip to content
/ tcsh2bash Public

Converts tcsh script to bash...eventually...still a work in progress

Notifications You must be signed in to change notification settings

et/tcsh2bash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Please note that this application is in a development stage.
I’m just adding this README, so github will stop complaining to me.

Tcsh2Bash

This application will read in a tcsh script and try to output the bash equivalent.

Motivation

Tcsh, an improvement on the C shell, is generally chosen as a default shell for many environments
because of how it mimics the C language. However, there are many ambiguities and limitations
with the language. Additionally, documentation on the language is sparse compared to bash.

This application is developed for people trying to migrate from tcsh to bash such as converting
a cshrc to bashrc or for people who want to support bash on a tcsh driven system.

Requirements

Ruby 1.9.2 (older versions probably work, this is just the one I use)
RubyGems

I recommend installing both with rvm

Additionally, you will need the following gems
treetop 1.4.8
trollop 1.16.2

Usage

Inside the bin directory is an executable called “tcsh2bash”.

Run it as follows

  • Output to standard out: ./tcsh2bash --infile cshrc
  • Output to a file: ./tcsh2bash --infile cshrc --outfile bashrc

Sample

Input

alias hello goodbye
setenv editor vim
set p=d
q243aca 0w3

Output

alias hello=goodbye
export editor=vim
p=d
#######################
# Unable to parse: q243aca 0w3
#######################

Additional Notes

There are no guarantees that the bash output produces the same logic as the tcsh script so please
review the changes especially if using this in a production environment.
Also, this application is not a mind reader. If you feed it a malformed tcsh script,
it doesn’t make any “logical” guess at what you meant.

About

Converts tcsh script to bash...eventually...still a work in progress

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages