[19:28] <Blue_> Hello!
[19:30] <penguin42> Hey
[19:31] <Blue_> I am on Ubuntu, I found out that on C shell, the command, source script arg, takes the arg as an empty string. This error does not occur in Linux Red Hat. Is the error documented in the Ubuntu website?
[19:32]  * penguin42 hasn't done C shell for about 20 years :-)
[19:32] <penguin42> can you give me the exact line you typed and what it says?
[19:43] <Blue_> First, at the prompt, I type the command, csh, to get to the C shell. Second, I execute the command, source abc.csh abc and the output: The first parameter is . In the abc.csh file, it has two statements. First statement:#/bin/csh and the second statement:echo The first parameter is $1
[19:45] <Blue_> I also type the command: chmod 777 abc.csh after creating the file abc.csh
[19:45] <penguin42> hang on, that first line should be #!/bin/csh
[19:45] <penguin42> the ! is important
[19:46] <Blue_> Sorry, yes, it was #!/bin/csh
[19:46] <Blue_> I mis-typed it.
[19:46] <penguin42> no problem
[19:47] <penguin42> OK, so what happens with that script?
[19:49] <Blue_> After I create the file abc.csh, I run the command chmod 777 abc.csh. Then, I ran the command, source abc.csh abc. The output should be The first parameter is abc. However, the actual output is The first parameter is.
[19:50] <Blue_> After I created the file abc.csh, I ran the command chmod 777 abc.csh. Then, I ran the command, source abc.csh abc. The output should be The first parameter is abc. However, the actual output was: The first parameter is
[19:50] <penguin42> ok, so I've just done that on ubuntu u and it seems to work and shows the parameter, so I'm not sure why it's not working for you; but the other thing is you've not quite got the reason for doing the chmod - you don't need to use chmod if you're going to use source, you only need it if you run it directly
[19:52] <Blue_> Did you do it on Ubuntu 14.04?
[19:52] <penguin42> hmm no, I wonder if I have a .04 around
[19:53] <Blue_> I did it on 13.04 also.
[19:54]  * penguin42 looks which VMs he has
[19:54] <penguin42> ah 14.04 is trusty isn't it?
[19:54] <Blue_> It should.
[19:55] <penguin42> ah, I've got a 14.04 vm here
[19:55] <penguin42> ok, so an observation; on 14.10 it's using tcsh when you ask for csh, on 14.04 it's using bsd-csh
[19:55] <Blue_> https://wiki.ubuntu.com/Releases
[19:56] <penguin42> Blue_: Which shell are you in when you do the source?
[19:56] <Blue_> I ran the command, csh, to go to the C shell.
[19:56] <penguin42> ok
[19:57] <penguin42> Blue_: So yes, this looks like a difference in behaviour between bsd-csh and tcsh
[19:57] <Blue_> It may work on tcsh but it does not work on csh
[19:58] <penguin42> Blue_: Many systems just run tcsh when you ask to run csh
[19:58] <penguin42> Blue_: Do you understand what the 'source' is for and what the chmod is for?
[20:00] <Blue_> Is it for setting the environment on the current shell?
[20:01] <penguin42> no
[20:01] <Blue_> Okay, what does the 'source' is for?
[20:01] <penguin42> Blue_: 'source' reads the commands from the file you specify as if you had typed them at the command prompt,  if   you do the chmod and then do    ./abc.csh   it runs abc.csh in a new shell - it's only for the later case that you need the chmod
[20:03] <Blue_> Okay, thanks!
[20:03] <penguin42> Blue_: now if you do the ./abc.csh that works on both bsd-csh and tcsh
[20:04] <Blue_> Okay, thanks!
[20:04] <penguin42> Blue_: The command you run with csh goes through a chooser that picks what to run, you can change it with  update-alternatives,   so if you install tcsh  you can make  csh   run that
[20:07] <Blue_> If I do not have tcsh installed, I ran the command, source abc.csh abc. I do not see the output as The first parameter is abc
[20:08] <Blue_>  If I do not have tcsh installed, I ran the command, source abc.csh abc. I do not see the output as: The first parameter is abc.
[20:08] <penguin42> right, it's just a difference in the behaviour of tcsh and bsd-csh
[20:09] <penguin42> both work if you do ./abc.csh hello    instead of using source
[20:11] <Blue_> Is the bug filed in Ubuntu?
[20:11] <penguin42> I don't think it's a bug
[20:11] <penguin42> it's just a difference between bsd-csh and tcsh
[20:13] <penguin42> Blue_: Passing parameters through source is not that common, actually using source isn't that common
[20:13] <Blue_> If I go to a Linux Red Hat and run the command, csh, Then run the command, source abc.csh abc. I can see the output as: The first parameter is abc.
[20:13] <penguin42> Blue_: Whether it's a bug in bsd-csh you'd really want to take up with the bsd-csh guys, because I'm not sure it's defined
[20:14] <penguin42> Blue_: So what makes you think it's a bug in the csh ubuntu uses?
[20:14] <penguin42> Blue_: What is the right definition of the csh behaviour of source?
[20:14] <hggdh> well, source (or "." in bash) is not THAT uncommon. What is uncommon is passing parameter to it
[20:15] <penguin42> right
[20:15]  * penguin42 isn't sure if csh is covered by posix or not or if there is any fixed definition of it
[20:15] <hggdh> yeah, neither am I
[20:15] <Blue_> If I go to a Ubuntu and run the command, csh, Then run the command, source abc.csh abc. I should see the output as: The first parameter is abc. The behavior should be the same as in the Linux Red Hat. Am I correct?
[20:16] <hggdh> Blue_: penguin42 has gone thru already. Summary is it depends: is csh and tcsh are identical, version differences, etc
[20:16] <penguin42> Blue_: http://www.kitebird.com/csh-tcsh-book/csh.pdf  doesn't specify parameters to source (page 14)
[20:17] <penguin42> sorry, 15
[20:17] <penguin42> Blue_: No, you're wrong
[20:17] <penguin42> Blue_: You're failing to understand 1) The difference between source and running a shell script directly   2) What defines the behaviour of source   3) That there are differences between different implementations
[20:18] <penguin42> Blue_: Compare that document above with the tcsh manpage http://www.kitebird.com/csh-tcsh-book/tcsh.pdf  page 34   that lists it's source takes args
[20:19] <hggdh> and, now, one should point out that tcsh and csh are *not* the same thing
[20:21] <Blue_> I am sorry. I do not understand why there are different behaviors between Red Hat Linux and Ubuntu.
[20:22] <penguin42> Blue_: Because there are multiple implementations of csh, they have subtle different behaviours
[20:23] <penguin42> Blue_: The feature you're using is one of these differences because you're not using the feature you think you are
[20:24] <penguin42> Blue_: Go and read those two documents I pasted which define the source command in two different csh versions
[20:35] <Blue_> I apologize to repeat my question because I still do not quite understand. Is Red Hat Linux csh is the same as tcsh? I did the command, ps -p $$, in the Red Hat Linux. I saw CMD=csh.
[20:36] <Blue_> Is Ubuntu csh is not the same as tcsh? Is that the reason I am seeing different behaviors between Ubuntu and Red Hat Linux?
[20:38] <penguin42> correct, the csh on 14.04 is bsd-csh not tcsh
[20:39] <penguin42> (by default if you just install csh, you can install tcsh if you want)
[20:44] <hggdh> and, usually, tcsh will set itself as csh
[20:44] <Blue_> I googled bsd-csh and was unable to find its definition. What are the difference between bsd-csh and csh? Is bsd-csh the same as csh?
[20:46] <penguin42> see the manpages I posted
[20:46] <hggdh> bsd csh was also known as Berkeley csh. 'bsd' means "Berkeley Software Distribution"
[20:46] <penguin42> right, bsd was one of the early unix systems
[20:47] <penguin42> I think bsd systems had the original csh but not 100% sure on that
[20:47] <hggdh> and we owe a LOT to the folks at UC-Berkeley
[20:49] <hggdh> not sure either. I do not remember if csh started at Bell Labs, and bsd-csh was a variant
[20:51] <hggdh> ah, wikipedia to the rescue -- csh was authored by Bill Joy, while he was at UC-B
[20:51] <penguin42> yeh that rings a bell
[20:52] <hggdh> so bsd-csh and csh are the same
[20:54] <Blue_> If Red Hat Linux csh is the same as tcsh? Why did I see CMD=csh after running the command, ps -p $$, in the Red Hat Linux? <hggdh> said, tcsh will set itself as csh. Is it the answer?
[20:55] <Blue_> If Red Hat Linux csh is not the same as tcsh, why did I see CMD=csh after running the command, ps -p $$, in the Red Hat Linux? <hggdh> said, tcsh will set itself as csh. Is it the answer?
[20:55] <hggdh> Blue_: because usually tcsh will install itself as csh (it *is* a C shell, after all). But I do not know if RH uses tcsh or csh. If I were to do it, I would go tcsh
[20:55] <hggdh> Blue_: so yes, this is the answer
[20:56] <hggdh> probably :-)
[20:56] <hggdh> Blue_: you probably can find it by 'rpm -q -a | grep csh' on RH system
[20:57] <hggdh> if you only see tcsh shown as installed, then there you go
[21:03] <Blue_> Yes, I saw tcsh on the Red Hat Linux machine. I tried the command, rpm -q -a | grep csh, on Ubuntu. I gave the error: rpm:Command not found.
[21:04] <Blue_>  Yes, I saw tcsh on the Red Hat Linux machine. I tried the command, rpm -q -a | grep csh, on Ubuntu. It gave the error: rpm:Command not found.
[21:05] <Blue_> May be rpm is a Red Hat command only.
[21:06] <Blue_> rpm is Red Hat specific.
[21:08] <hggdh> rpm is available on RH, Fedora, and CentOS, at least
[21:08] <hggdh> maybe it is out of your default path
[21:10] <hggdh> on Debian (and variants, like Ubuntu) you should use 'dpkg -l \*csh'
[21:24] <Blue_> hggdh++: Thanks! I ran the command, dpkg -l \*csh, on Ubuntu and found Name=ii csh. Description=Shell with C-like syntax
[21:25] <Blue_> hggdh++: Thanks! I ran the command, rpm -q -a | grep csh on Red Hat Linux and found tcsh.
[21:31] <Blue_> The reason why there are different behaviors in Ubuntu and Red Hat Linux is Ubuntu uses Berkeley Software Distribution C shell and Red Hat Linux uses tcsh. Am I correct?
[22:19] <sfp> would a member of ubuntu-bugcontrol please nominate bug #1409798 for 14.04 and 14.10?
[23:47] <hggdh> Blue_: correct
[23:50] <hggdh> sfp: Trusty and Utopic have been targeted
[23:51] <teward> hggdh: boo you stole it from me
[23:51]  * teward glares
[23:51] <teward> nah i kid :)
[23:52] <hggdh> teward: heh