help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] bash to csh converter?


From: Steven Ford
Subject: Re: [Help-bash] bash to csh converter?
Date: Sat, 19 Mar 2016 12:54:27 -0400

Mun,

I am also curious about the details here.

What kind of issues were you running into using the bash scripts from csh?
Are they meant to create aliases or set environment variables?
How many lines of bash code do you have that rewriting them is not
practical?

If the bash scripts have functions that they need to use, you could make
those functions accessible as individual bash scripts or modify your bash
scripts to call a function passed as an argument.

Something like this:

#!/bin/sh

function foo {
  echo foo
}

function bar {
  echo bar
}

$@

Would allow you to invoke the bash functions like ./script.sh foo with
minimal modification to the bash script by adding $@ to the bottom. That is
if the functions are what you need.

Hope this is helpful.

Regards,

Steve

On Sat, Mar 19, 2016 at 2:21 AM, Mun <address@hidden> wrote:

> Hi Bob,
>
> Thank you for your reply.
> Please see my comments below.
>
> On Fri, Mar 18, 2016 at 05:16 PM PDT, Bob Proulx wrote:
> BP> Mun wrote:
> BP> > I need to convert some scripts from bash to t/csh and was wondering
> if
> BP> > anyone knew of any good converter script/mjtool?  So far my
> Google'ing has
> BP> > been fruitless.
> BP>
> BP> Your posting prompts me to ask questions.  Since #!/bin/csh scripting
> BP> is generally regarded as inferior to #!/bin/sh scripting, a proposal
> BP> such as this triggers questions.  Are you sure you want to go that
> BP> direction and not the other way?  Please, please say that it is the
> BP> other way around.
>
> Sorry, but I really need to go from Bash to csh.  I write my shell
> scripts in Bash; but many folks at work use a csh env.  At this point, I
> am researching a solution for them: one possibility being the conversion
> of said scripts to csh.
>
> BP> Note that scripts can always use #!/bin/bash to
> BP> select the interpreter it doesn't make sense to convert those scripts
> BP> to #!/bin/csh.
>
> I had already tried that but ran into issue.
>
> BP> I can only assume that you are working in a tcsh prompt and are
> BP> sourcing files and are trying to convert some bash to something that
> BP> can be sourced in the csh .login file.  Am I close?
>
> That's pretty close; except I work in the Bash world.  Many of my peers
> do not, but they require the functionality of the Bash scripts.
>
> Thanks,
>
> --
> Mun
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]