Image of the glider from the Game of Life by John Conway
Skip to content

Bash Meets Csh

So, continuing in my effort at work to convert many of the scripts that we have to Bash, I came across a problem: I am stuck at work using Csh. So, can I run this sourced file, which contains many Bash functions, in Csh?

For example, here is a brief rundown of my code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
umask 000
alias one="blah"
alias two="blah blah"
alias three="blah blah blah"
function_one()
{
    # some code here
}
function_two()
{
    # some code here
    # some code here
}
function_three()
{
    # some code here
    # some code here
    # some code here
}

And so on. Basically, a single file that contains many aliases and many functions. If this file is sourced, can I use the functions in csh?

YES! YES!! YES!!!

Of course I can! That is the great thing about Linux! I have options. I have choices. If I can program with one scripting language, but I am stuck using another (like I am using Csh at work), as long as I reference the executable and it is installed on the system, I can use it. I don't have to source the file either (although in my case at work, I do). I can run any script in any language using any shell. Again, just as long as the language is installed and the executable referenced.

Post a Comment

Your email is never published nor shared.

Switch to our mobile site