Giter VIP home page Giter VIP logo

sourceany's Introduction

Source csh scripts in bash

Objectives

Many 3rd party software in Linux come with environment setup scripts, which typically detect OS platform and version, and set up environment variables and shell aliases.

Traditionally, csh is popular among EDA software users and a lot of environment setup scripts were written in csh. Although bash has long become the de facto shell in most Linux distros, and csh considered archaic, many legacy csh scripts survived today.

This little script attempts to allow bash users to source legacy environment setup scripts written in csh. Conversely, it allows old-school csh users to source environment setup scripts written in bash.

Usage

The following script reads an .csh script and write a .sh script that produces the same environment.

$ ./sourceAny.py -c "/sw/intel/bin/iccvars.csh intel64" -o ./setenv.sh
$ source ./setenv.sh
$ icc hello.c

The following script does the trick in the other direction.

% ./sourceAny.py -s "/opt/cogenda/current/bin/setenv.sh" -o ./setenv.csh
% source ./setenv.csh
% VisualTCAD

To list all available options, type

$ ./sourceAny.py -h

How it works

  • Save all environment variables, source the input script, save all environment variables again.
  • Compare the environment variables before and after.
  • Write a script in the output format that produces the equivalent changes.
  • Tada

Limitations

Many. Your mileages vary. Patch welcomed.

sourceany's People

Stargazers

Colin Marquardt avatar

Watchers

 avatar

Forkers

tejaskarelia17

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.