Hacker News new | comments | show | ask | jobs | submit login

> The same thing happens to my kids when I present them with a bash shell. They don't understand how to read the instructions

Uhm, the issue here is squarely on Bash's end, not your kid's. Even the Windows command prompt is far more intuitive to learn. I know because I vividly remember how much more confused I got when learning the former.

In Windows, when you type "help", it actually gives you helpful commands: COPY, MOVE, DEL, REN/RENAME, etc. and at least the basic commands are actually what you'd expect. At least you have a foothold somewhere that you can ground yourself, and you start learning a bit more every time.

Try that in Bash, and good luck learning out how to do anything in Bash on your own. Oh, you want help? I gotchu! I'm guessing you're looking for job_spec, bg, compopt, coproc, disown, shopt, or trap? Oh I'm so sorry, you said all you wanted was to just copy a file? Haha I'm just a shell! You can't expect me to know how know what it means to "copy" a file! I can't even find that command! But if you need help, type "man -k" (what kind of a name is that??) to find out more about other commands. Oh, so you typed "man -k"? Okay, "apropos what?"??? (You, thinking to yourself: is 'apropos' even an English word?? I literally just typed in man -k like they told me to, and I got back a question I don't understand...) And on and on and on, until weeks later you realize the darn command was helpfully named 'cp' and not 'copy'...




Fully agree with the crapiness of learning Bash 100%. Bash is very hard to learn compared to, say, the OS UI in Android or Nintendo Switch.

But, my point is that my kids lose all their confidence and all their patience, and they become tentative and fearful. They show all the same symptoms that were mis-attributed to age in the above comments.

On a game console, my kids are not afraid to explore every menu and push every button. In a text interface, they are lost and they don't try things. They seem to learn slowly and they don't seem to listen to instruction because of how different text UIs are from the GUIs they know. When I get a new text interface, I know all kinds of things to try, and I do so without much fear.


> In Windows, when you type "help", it actually gives you helpful commands: COPY, MOVE, DEL, REN/RENAME, etc. and at least the basic commands are actually what you'd expect. At least you have a foothold somewhere that you can ground yourself, and you start learning a bit more every time.

Yes, this. I recall back in the MS-DOS days that I frequently used a text-GUI help menu that showed all the commands you could do and what each one did.

Personally, this is what I struggle with on *nix shells - I can do the very basics but there's little guidance showing you a broad overview of what is possible. Granted, the world is bigger now but if you asked me how to do a random task I'd probably google it first instead of reading a man page.


> Personally, this is what I struggle with on *nix shells

Once you learn the 8000 or so commands, it becomes incredibly intuitive.


Don't forget all the little tricks in chaining them! And all the magic you can do with pipes.


> Personally, this is what I struggle with on *nix shells

It's not just the shells! ;)


Only problem is, those commands are useless. COPY won't back up a directory tree. You need XCOPY. Oops, XCOPY chokes for weird reasons and terminates with a strange error message because a path was more than 255 bytes. It needs a bazillion options to do the equivalent of GNU's "cp -a". If you go online to get help with this, the best advice you get is to download and install something called RoboCopy.

Yes, MS-DOS was easy to learn. XCOPY worked in MS-DOS.


https://unix.stackexchange.com/a/87128

"copy doesn't copy directory structures, it will only copy the files, hence the error message you're encountering. To do a deep copy such as this you can enlist either the tar command and use the construct tar cvf - --files-from=... | (cd /home/tmp/test/files/; tar xvf -) or you can just use rsync."

That's so much better..


cp most certainly does copy directory structures. Just not filtered ones whereby just certain entries are arbitrarily selected from the source tree and only those are replicated in the destination tree.

The issue in the question is that the person has expanded, into the cp command line, a bunch of full paths, effectively like "cp a/b/c/file1 a/b/d/file2 .... dest" and wants those relative paths to be re-created under dest as dest/a/b/c/file1 and so on. Indeed, cp does not do that; it simply puts the specified objects file1 file2 ... into dest.

An option to create each object's relative path under dest would be useful, but it would be a pretty awful default behavior.

GNU cp has this option:

  `--parents'
     Form the name of each destination file by appending to the target
     directory a slash and the specified name of the source file.  The
     last argument given to `cp' must be the name of an existing
     directory.  For example, the command:

          cp --parents a/b/c existing_dir

     copies the file `a/b/c' to `existing_dir/a/b/c', creating any
     missing intermediate directories.
GNU Coreutils is in active development, unlike the Windows command line which is basically abandonware (as, to be even-handed, is the Unix (tm) command line.)




Applications are open for YC Winter 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: