Reputation
3,298
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
15 32
Newest
 Nice Answer
Impact
~276k people reached

Mar
23
comment What does this mean? $ . test.sh
@chepner: That's entirely plausible. I haven't bothered to experiment with whether the current directory is searched first or last. For the most part, it is not important to this question, which is about the high-level difference between sourcing and executing a script. I agree, though, that it does matter if you're going to make a bullet-proof system depending on such a script.
Mar
23
answered What does this mean? $ . test.sh
Mar
23
comment What does this mean? $ . test.sh
The dot command pre-dates the source command by years. It was in the original Bourne shell. The C shell had the source command for the same job; bash imported that as a synonym for . some time later.
Mar
22
comment Rename a file based on the owner - linux/Unix
The + is useful when you want to provide a list of file names to a single invocation of the command. Here, though, you want to execute each mv with just two arguments (old name and new name), so you need to execute mv once for each file that's found. Or you use a more complex rename command, such as a Perl-based one that can do a regex mapping, so -exec rename 's/^/s/' {} + is now appropriate. (Beware: there are several sub-species of command called rename, and they're mostly feeble by comparison with the Perl-based one.)
Mar
22
answered Rename a file based on the owner - linux/Unix
Feb
18
awarded  linux
Feb
14
awarded  Notable Question
Feb
9
comment How can I prevent bash from executing 'rm' when ' * ' is one of the arguments?
I don't think relying on an alias for rm is a good idea. You'll get caught without the alias sometime, but you'll still be relying on its protection, and all hell will break loose. It is better to learn to think "rm is dangerous; let me check my command line" than to rely on a crutch.
Jan
30
comment Error when installing cpanminus on Mac OS X
Personally, I never modify the system's installation of Perl; I never use it, either. I always build my own so that I can be as up-to-date as I choose. But that's just me.
Jan
30
comment Error when installing cpanminus on Mac OS X
If the spaces or tabs in /System/Library/Perl/5.12/darwin-thread-multi- 2level/CORE/config.h are not an artefact of the way you're copy'n'pasting, then you need to find out why you have the spaces or tabs in the name. If they are an artefact, then you need to investigate why you don't have /System/Library/Perl/5.12/darwin-thread-multi-2level/CORE/config.h present. It's there OK on my Mac OS X 10.7.5 machine — though I'm using my own Perl 5.16.2 rather than the system Perl 5.12.3. I can trade perl -V output with you if you think that will help.
Jan
10
comment What does -p do on shell script?
@umlaeute: bash does have a -p option.
Jan
10
answered What does -p do on shell script?
Dec
26
comment OS X Terminal command line prompt hostname changed to unknownXXXXXXXXXXXX
Based on the blog referenced in joerick's answer, it is likely that your DHCP or BootP server, or the reverse DNS lookup, is yielding the unknown<MAC address> (where that MAC is unrelated to it being a Mac). So, look to your network infrastructure for an explanation.
Dec
26
comment OS X Terminal command line prompt hostname changed to unknownXXXXXXXXXXXX
The x-ref'd blog entry is a little dated, unfortunately. On my (slightly dated) 10.7.5, the /etc/hostconfig file contains (slash for newline): # This file is going away / AFPSERVER=-NO- / AUTHSERVER=-NO- / TIMESYNC=-NO- / QTSSERVER=-NO-. Note that there is no HOSTNAME entry as mentioned in the blog. However, the name determination sequence (DHCP or BootP, Reverse DNS, System Preferences, localhost) is likely to be close to the algorithm used.
Dec
26
comment OS X Terminal command line prompt hostname changed to unknownXXXXXXXXXXXX
Welcome to Stack Overflow. Have you rebooted? Have you restarted terminal? Do you run any Ruby in your profile? How does your computer identify itself? Simply installing RoR should not affect your terminal at all. Your question is in danger of being closed as 'off topic'; it is border-line on topic here in my view. You might get a more receptive response on the Apple Stack Exchange site, but they'll likely want to know answers to the questions I raised.
Dec
19
comment Would shell command join cause out of memory?
It ran out of memory because you're not being very sensible in your request. You're doing a Cartesian product of the rows in file1 and the rows in file2. I'm a little surprised it was unable to hold all of 500 MB in main memory. I don't know if it makes any difference if you reorder file1 and file2 on the command line (worth a try because it is easy), but I won't be surprised to find it makes no difference. Are you on a 32-bit machine or 64-bit? More saliently, is the join executable 32-bit or 64-bit? Are you sure the output is useful?
Dec
19
answered Would shell command join cause out of memory?
Dec
16
comment How to have .profile sourced automatically
Please explain what you mean by 'on system restart', and the context in which the ~/.profile is not being read. Do you mean that it is not read by the shell in your terminal window? Or something else? Have you configured your terminal window to run a login shell?
Dec
16
comment How to have .profile sourced automatically
Which shell are you using? Bourne, Korn and Bash shells normally read ~/.profile.
Dec
16
comment Does rm -r follow symbolic links?
Doesn't really need to be on Super User; it is a question about a program used in shell programming, and as such is on topic for Stack Overflow.