On Fri, 09 Jan 1998 23:01:54 +0100, "Rob S. Wolfram" wrote: > David Stern wrote: >>[..] > news://comp.unix.shell
I know now. > > 1.) How do I insert a newline character in a "double-quoted" string? > If you mean "when using bash's built-in echo command", use > echo -e "Test\nMoreText" I'll use that in the future. > > 2.) What is a good method to reassign variables interactively? > read VAR Got it, thanks. > > #!/bin/sh > You should use '#!/bin/bash' really, because now sh is just a link > to bash, but you are not guaranteed that in a future version it will > be another shell, or that bash _will_ act more (dumb) Bourne like in > the future when called as 'sh' (I for one would appreciate it). Noted. However I thought that /bin/sh was more "un*x-compatible", thus more extensible across other platforms where bash may not be available, therefore making /bin/sh preferred. True?/Not true? (When, if ever, do you think use of /bin/sh is appropriate?) > > echo "" ; echo "David's BackupUtility v. 0.1." ; echo "" ; > > while [ $option -ne 7 ] > Do surround vars in a test in double quotes, to protect the empty > string, like in: while [ "$option" -ne 7 ] Noted. Thankyou very much. > > echo " Copy method is $copymethod " > > ; echo "" ; > ^ I suppose this belongs to the last line? I set email linewrap to 72, but allowed a few more in my code. > > read option > > case $option in > > 1) > > echo " Change source list." > > echo " How do I interactively reassign \$dbu_list ?" ; echo "" ; > read dbu_list > Or maybe you want to use another var, test its validity and eventually > reassign your old one with $SECONDVAR ? Exactly. Immediately following the original post, a number of thoughts I was having formed ideas, which dawned some realizations and I haven't really mapped out where I want to take this, because some of my ideas will require more error handling than I think is suited for a bash script. Fortunately, I got it to work and added a few of my ideas, so it works well enough to pass proof test, which allows me to use it a little and see how I'd like it to develop. > Politically biassed advice: man cpio Although I'm not intimate with cpio yet, that's the agenda. In any event, my default copy method (safecopy2) implements cpio. I've intentionally made this modular so I don't have do any deathly hacking should I decide to make any changes. Thanks to you all, it works pretty well. :-) I more or less figure this is amateur code, but it works pretty well, so if anyone wants to use or mangle it, feel free to have a go at it. :-)
<<< message/external-body; name="/home/share/bin/safecopy2"; access-type=LOCAL-FILE; site="localhost.localdomain": Unrecognized >>>
<<< message/external-body; name="/home/share/bin/dbu"; access-type=LOCAL-FILE; site="localhost.localdomain": Unrecognized >>>
David Stern [EMAIL PROTECTED] http://weber.u.washington.edu/~kotsya/