Page 2 of 2

Re: how to copy 1 complete folder (recursively) int another

Posted: Wed Jan 06, 2016 11:16 am
by jamesh
Thread leaned of cruft.

To Davenull, you need to get some basic Linux knowledge under your belt, you will progress much faster. Lots of Linux primers out there, there's a link earlier in this thread that will help. The concepts are all pretty simply tbh, so shouldn't take long.

Re: how to copy 1 complete folder (recursively) int another

Posted: Wed Jan 06, 2016 11:22 am
by rpdom
davenull wrote:what means redirection? After starting by the icon I already execute in the terminal.
Is there perhaps a command like getchar() in a bash script to wait for ENTER before closing the window?
read

Re: how to copy 1 complete folder (recursively) int another

Posted: Wed Jan 06, 2016 11:27 am
by davenull
@jamesh:
Although this is OT and it would be better to maintain this discussion by PMs:
yes I know and I do what's possible to me as a non-English speaking hobbyist and just a complete beginner to Linux.

so Is there perhaps a command like getchar() in a bash script to wait for ENTER before closing the window?

Re: how to copy 1 complete folder (recursively) int another

Posted: Wed Jan 06, 2016 1:32 pm
by jamesh
davenull wrote:@jamesh:
Although this is OT and it would be better to maintain this discussion by PMs:
yes I know and I do what's possible to me as a non-English speaking hobbyist and just a complete beginner to Linux.

so Is there perhaps a command like getchar() in a bash script to wait for ENTER before closing the window?
man read


But....

It took me 20s to google for this as I didn't know the answer offhand. It took longer for you to ask the question here, than it did for me to google for it. You will save yourself a lot of time and grief by doing a quick search first before asking questions. That how I learnt Linux, and still use it - I can never remember some of the more arcane command lines, so just google for them when I need to. I don't ask questions on Forums (unless cannot find the answer on Google - but tbh, almost everything you will ever need to ask is already covered somewhere out there), it's just toooo slow. I need the answer now, not after spending 2 minutes posting a question then waiting an indefinite time for an answer.

Re: how to copy 1 complete folder (recursively) int another

Posted: Wed Jan 06, 2016 1:55 pm
by QuietZone
man read
Heh heh - that doesn't do much that is useful:

Code: Select all

READ(2)                    Linux Programmer's Manual                   READ(2)

NAME
       read - read from a file descriptor

SYNOPSIS
       #include <unistd.h>

       ssize_t read(int fd, void *buf, size_t count);
And therein actually is the problem with man pages when you are actually trying to learn something (as opposed to just needing to look up a specific piece of information).

The problem is particularly acute when you are trying to learn shell, because the individual commands don't have their own man pages (*). It is all in "man bash" (or whatever shell you are using). I've actually gotten pretty adept at doing "man bash" (which is enormous) and finding the specific thing I need (the "xxx" command and/or the --fooBaz option), but that in and of itself is a skill that newcomers won't have (and will need to develop).

(*) Note that in C, they more or less do. I.e., if you want to know what "read" does (in C), you can, indeed, do "man read" and get the scoop.

Re: how to copy 1 complete folder (recursively) int another

Posted: Wed Jan 06, 2016 2:04 pm
by PeterO
See the "Press any key" example on this page:
http://wiki.bash-hackers.org/commands/builtin/read

Re: how to copy 1 complete folder (recursively) int another

Posted: Wed Jan 06, 2016 2:19 pm
by jamesh
QuietZone wrote:
man read
Heh heh - that doesn't do much that is useful:

Code: Select all

READ(2)                    Linux Programmer's Manual                   READ(2)

NAME
       read - read from a file descriptor

SYNOPSIS
       #include <unistd.h>

       ssize_t read(int fd, void *buf, size_t count);
And therein actually is the problem with man pages when you are actually trying to learn something (as opposed to just needing to look up a specific piece of information).

The problem is particularly acute when you are trying to learn shell, because the individual commands don't have their own man pages (*). It is all in "man bash" (or whatever shell you are using). I've actually gotten pretty adept at doing "man bash" (which is enormous) and finding the specific thing I need (the "xxx" command and/or the --fooBaz option), but that in and of itself is a skill that newcomers won't have (and will need to develop).

(*) Note that in C, they more or less do. I.e., if you want to know what "read" does (in C), you can, indeed, do "man read" and get the scoop.
Very good point - my bad.

man bash

then about line 3600 for explanation of the 'read' command in bash. Or use google for examples.

Re: how to copy 1 complete folder (recursively) int another

Posted: Wed Jan 06, 2016 2:22 pm
by rpdom
jamesh wrote:man bash

then about line 3600 for explanation of the 'read' command in bash. Or use google for examples.
For "builtin" commands, like read, you can use the "builtin" help command:

Code: Select all

pi@raspi3 ~ $ help read
read: read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]
    Read a line from the standard input and split it into fields.
    
    Reads a single line from the standard input, or from file descriptor FD
    if the -u option is supplied.  The line is split into fields as with word
    splitting, and the first word is assigned to the first NAME, the second
    word to the second NAME, and so on, with any leftover words assigned to
    the last NAME.  Only the characters found in $IFS are recognized as word
    delimiters.
    
    If no NAMEs are supplied, the line read is stored in the REPLY variable.
    
    Options:
      -a array	assign the words read to sequential indices of the array
    		variable ARRAY, starting at zero
      -d delim	continue until the first character of DELIM is read, rather
    		than newline
      -e		use Readline to obtain the line in an interactive shell
      -i text	Use TEXT as the initial text for Readline
      -n nchars	return after reading NCHARS characters rather than waiting
    		for a newline, but honor a delimiter if fewer than NCHARS
    		characters are read before the delimiter
      -N nchars	return only after reading exactly NCHARS characters, unless
    		EOF is encountered or read times out, ignoring any delimiter
      -p prompt	output the string PROMPT without a trailing newline before
    		attempting to read
      -r		do not allow backslashes to escape any characters
      -s		do not echo input coming from a terminal
      -t timeout	time out and return failure if a complete line of input is
    		not read within TIMEOUT seconds.  The value of the TMOUT
    		variable is the default timeout.  TIMEOUT may be a
    		fractional number.  If TIMEOUT is 0, read returns immediately,
    		without trying to read any data, returning success only if
    		input is available on the specified file descriptor.  The
    		exit status is greater than 128 if the timeout is exceeded
      -u fd		read from file descriptor FD instead of the standard input
    
    Exit Status:
    The return code is zero, unless end-of-file is encountered, read times out
    (in which case it's greater than 128), a variable assignment error occurs,
    or an invalid file descriptor is supplied as the argument to -u.

Only 41 lines of text to look through :)

Re: how to copy 1 complete folder (recursively) int another

Posted: Wed Jan 06, 2016 3:24 pm
by davenull
thanks - 1st of all I did not even know what you mean by
read
or
man read

I interpreted it as
"dude, study!" :shock:

I never assumed "read" to be the command I was looking for (or I had to search or to look for), in my MSDOS days I was using "pause" for this purpose, and as Linux is C-based I had more expected something C-command-like as getchar, getch, getc, while not kbhit, or even cin.

Then, 2nd, Linux is a big mess to me. To me an operating system is only good if it's working underneath and if one doesn't even perceive it all.

Ok, I need certain simple commands, but in the first line I want to programm my map-and-explore-robot and my neural nets in C (as I have already established by Arduino or whatever) - but not the entire operating system itself. Surely I will learn step by step and my skills will improve as times go by, but that's not what I'm currently starting with.

So I would appreciate if you provided just 1 line I had to write out of the 30 trillion read options hidden in perhaps 3600 million manual lines which one to take to simply wait for an keypress and/or ENTER before the terminal window would close automatically on it's own by it self... ;)

Re: how to copy 1 complete folder (recursively) int another

Posted: Wed Jan 06, 2016 3:49 pm
by PeterO
Why do I bother ?
PeterO

Re: how to copy 1 complete folder (recursively) int another

Posted: Wed Jan 06, 2016 3:51 pm
by davenull
don't oracle, be specific!

Re: how to copy 1 complete folder (recursively) int another

Posted: Wed Jan 06, 2016 3:58 pm
by jamesh
davenull wrote:thanks - 1st of all I did not even know what you mean by
read
or
man read

I interpreted it as
"dude, study!" :shock:

I never assumed "read" to be the command I was looking for (or I had to search or to look for), in my MSDOS days I was using "pause" for this purpose, and as Linux is C-based I had more expected something C-command-like as getchar, getch, getc, while not kbhit, or even cin.

Then, 2nd, Linux is a big mess to me. To me an operating system is only good if it's working underneath and if one doesn't even perceive it all.

Ok, I need certain simple commands, but in the first line I want to programm my map-and-explore-robot and my neural nets in C (as I have already established by Arduino or whatever) - but not the entire operating system itself. Surely I will learn step by step and my skills will improve as times go by, but that's not what I'm currently starting with.

So I would appreciate if you provided just 1 line I had to write out of the 30 trillion read options hidden in perhaps 3600 million manual lines which one to take to simply wait for an keypress and/or ENTER before the terminal window would close automatically on it's own by it self... ;)
How much do you learn if someone simply gives you the exact line of bash you want? Not a lot, and you'll need to ask again the next time and the next time. But read up on it, and you learn. This seems appropriate https://en.wiktionary.org/wiki/give_a_m ... a_lifetime

As for Linux, well, as the OS used on most supercomputers, underneath Android, in set top boxes, TV's, routers, laptops, desktops, servers etc, with an installed base in the many many millions, it cannot be that bad!

Re: how to copy 1 complete folder (recursively) int another

Posted: Wed Jan 06, 2016 4:03 pm
by davenull
Ok, I need certain simple commands, but in the first line I want to programm my map-and-explore-robot and my neural nets in C (as I have already established by Arduino or whatever) - but not the entire operating system itself. Surely I will learn step by step and my skills will improve as times go by, but that's not what I'm currently starting with.
...
So I would appreciate if you provided just 1 line I had to write out of the 30 trillion read options hidden in perhaps 3600 million manual lines which one to take to simply wait for an keypress and/or ENTER before the terminal window would close automatically on it's own by it self...
BTW, your post is OT as I don't need to be lectured but simply asked for 1 command (and honestly, I have proven to know how to learn, eventually in my own profession).

Re: how to copy 1 complete folder (recursively) int another

Posted: Wed Jan 06, 2016 4:53 pm
by QuietZone
How much do you learn if someone simply gives you the exact line of bash you want? Not a lot, and you'll need to ask again the next time and the next time. But read up on it, and you learn.
I think we have to accept that OP is not interested in learning. And there's nothing wrong with that.

I am always thinking of the analogy between computers (the big big invention of my generation) vs. cars (the big big invention of a generation or 2 or 3 before mine).

Suppose that I have a flat tire. I know nothing about cars, so I take it to the service station and ask them to fix my tire. Suppose they respond with "Well, you do 'man tire' and figure it out from there". I say a bunch of things that aren't suitable for this forum and tell them I just want my tire fixed. I'm willing to pay you to do it for me - and I expect that is the normal way that things are done. I'm not going to do "man tire". Nor am I at all interested in getting my hands dirty. That's *your* job.

I think the previous paragraph summarizes the OP's mindset to a T. All we need to do is figure out a way for the payment part to work - but the real takeaway here is that OP is *not* interested in learning; he just wants his tire fixed.

Re: how to copy 1 complete folder (recursively) int another

Posted: Wed Jan 06, 2016 5:01 pm
by jamesh
OK, this thread has caused me much too much time to moderate, through reports, accusation of trolling, and general cockwombliness.

So it's closing. All the information required to answer the OP is present, including references, advice and the actual commands required.

Can I remind ALL participants in this thread to behave in further conversations. Or I will start dishing out temp bans. I really cannot be bothered with such pettiness, so the nuclear option will be used.