=== IKRAM_ is now known as IKRAM === drkokandy_ is now known as drkokandy [19:28] Hello! [19:30] Hey [19:31] 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] can you give me the exact line you typed and what it says? [19:43] 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] I also type the command: chmod 777 abc.csh after creating the file abc.csh [19:45] hang on, that first line should be #!/bin/csh [19:45] the ! is important [19:46] Sorry, yes, it was #!/bin/csh [19:46] I mis-typed it. [19:46] no problem [19:47] OK, so what happens with that script? [19:49] 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] 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] 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] Did you do it on Ubuntu 14.04? [19:52] hmm no, I wonder if I have a .04 around [19:53] I did it on 13.04 also. [19:54] * penguin42 looks which VMs he has [19:54] ah 14.04 is trusty isn't it? [19:54] It should. [19:55] ah, I've got a 14.04 vm here [19:55] 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] https://wiki.ubuntu.com/Releases [19:56] Blue_: Which shell are you in when you do the source? [19:56] I ran the command, csh, to go to the C shell. [19:56] ok [19:57] Blue_: So yes, this looks like a difference in behaviour between bsd-csh and tcsh [19:57] It may work on tcsh but it does not work on csh [19:58] Blue_: Many systems just run tcsh when you ask to run csh [19:58] Blue_: Do you understand what the 'source' is for and what the chmod is for? [20:00] Is it for setting the environment on the current shell? [20:01] no [20:01] Okay, what does the 'source' is for? [20:01] 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] Okay, thanks! [20:03] Blue_: now if you do the ./abc.csh that works on both bsd-csh and tcsh [20:04] Okay, thanks! [20:04] 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] 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] 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] right, it's just a difference in the behaviour of tcsh and bsd-csh [20:09] both work if you do ./abc.csh hello instead of using source [20:11] Is the bug filed in Ubuntu? [20:11] I don't think it's a bug [20:11] it's just a difference between bsd-csh and tcsh [20:13] Blue_: Passing parameters through source is not that common, actually using source isn't that common [20:13] 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] 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] Blue_: So what makes you think it's a bug in the csh ubuntu uses? [20:14] Blue_: What is the right definition of the csh behaviour of source? [20:14] well, source (or "." in bash) is not THAT uncommon. What is uncommon is passing parameter to it [20:15] 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] yeah, neither am I [20:15] 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] Blue_: penguin42 has gone thru already. Summary is it depends: is csh and tcsh are identical, version differences, etc [20:16] Blue_: http://www.kitebird.com/csh-tcsh-book/csh.pdf doesn't specify parameters to source (page 14) [20:17] sorry, 15 [20:17] Blue_: No, you're wrong [20:17] 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] 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] and, now, one should point out that tcsh and csh are *not* the same thing [20:21] I am sorry. I do not understand why there are different behaviors between Red Hat Linux and Ubuntu. [20:22] Blue_: Because there are multiple implementations of csh, they have subtle different behaviours [20:23] Blue_: The feature you're using is one of these differences because you're not using the feature you think you are [20:24] Blue_: Go and read those two documents I pasted which define the source command in two different csh versions [20:35] 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] 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] correct, the csh on 14.04 is bsd-csh not tcsh [20:39] (by default if you just install csh, you can install tcsh if you want) [20:44] and, usually, tcsh will set itself as csh [20:44] 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] see the manpages I posted [20:46] bsd csh was also known as Berkeley csh. 'bsd' means "Berkeley Software Distribution" [20:46] right, bsd was one of the early unix systems [20:47] I think bsd systems had the original csh but not 100% sure on that [20:47] and we owe a LOT to the folks at UC-Berkeley [20:49] not sure either. I do not remember if csh started at Bell Labs, and bsd-csh was a variant [20:51] ah, wikipedia to the rescue -- csh was authored by Bill Joy, while he was at UC-B [20:51] yeh that rings a bell [20:52] so bsd-csh and csh are the same [20:54] 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? said, tcsh will set itself as csh. Is it the answer? [20:55] 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? said, tcsh will set itself as csh. Is it the answer? [20:55] 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] Blue_: so yes, this is the answer [20:56] probably :-) [20:56] Blue_: you probably can find it by 'rpm -q -a | grep csh' on RH system [20:57] if you only see tcsh shown as installed, then there you go [21:03] 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] 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] May be rpm is a Red Hat command only. [21:06] rpm is Red Hat specific. [21:08] rpm is available on RH, Fedora, and CentOS, at least [21:08] maybe it is out of your default path [21:10] on Debian (and variants, like Ubuntu) you should use 'dpkg -l \*csh' [21:24] hggdh++: Thanks! I ran the command, dpkg -l \*csh, on Ubuntu and found Name=ii csh. Description=Shell with C-like syntax [21:25] hggdh++: Thanks! I ran the command, rpm -q -a | grep csh on Red Hat Linux and found tcsh. [21:31] 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] would a member of ubuntu-bugcontrol please nominate bug #1409798 for 14.04 and 14.10? [22:19] bug 1409798 in dropbear (Debian) "enable hmac-sha2-256, hmac-sha2-512 MAC algorithms" [Unknown,New] https://launchpad.net/bugs/1409798 [23:47] Blue_: correct [23:50] sfp: Trusty and Utopic have been targeted [23:51] hggdh: boo you stole it from me [23:51] * teward glares [23:51] nah i kid :) [23:52] teward: heh