shanenin

Moderator
  • Content Count

    3752
  • Joined

  • Last visited

Everything posted by shanenin

  1. 1. I have been a chronic drug addict since about age 14(daily pot smoker), I spent the years of age 21 - 27 shooting meth daily. My drug addiction is not really a secret, It is just part of me. I have never hid it, infact I enjoy shocking people with it I have been sober with the help of AA and God for over 5 years. 2. I depend on God for everything. With out my daily prayers and time spent with god, I would still be sticking a needle in my arm. I need God in my life. I used to be a hardened atheist(scientific type). Faced with the fact of dying by my own hands(slowly with meth, could not s
  2. so \c must not be supported in bash, is that what you are saying?
  3. I found one of those other things. #!/bin/bash RESPONSE= while [ -z "$RESPONSE" ]; do echo "Enter the name of the directory where your files are located:\c " read RESPONSE if [ ! -d "$RESPONSE" ]; then echo "ERROR: please enter a directory pathname." RESPONSE= fi done according to the book, my output should be Enter the name of the directory where your files are located: but I am getting Enter the name of the directory where your files are located:\c I thought that the "\" worked as quoting. So that would disable a special character? the letter "c" does not seem to
  4. it means "less then" were you asking that?
  5. thanks. I can see debugging programs being a huge undertaking. I have trouble finding them with just three lines of code
  6. I think i have copied this script exactly as printed in my book, but it keeps failing shane@mainbox shane $ cat scripts/loop #!/bin/bash x=0 while [ $x -lt 10 ] do echo $x x=`echo "$X + 1" | bc` done shane@mainbox shane $ ./scripts/loop 0 (standard_in) 1: parse error ./scripts/loop: line 3: [: -lt: unary operator expected
  7. sorry you already answered that(I missed it) I am sure you already knew these are equal expressions test -z $var [ -z $var ]
  8. would test -z $VAR be mainly used to check if a variable is already set? .
  9. is that meant to check if that is a set variable? In my mind these should be outputting 0 for the first one but 1 for the second one. shane@mainbox shane $ gg=""; [ -z $gg ]; echo $? 0 shane@mainbox shane $ gg=""; [ -n $gg ]; echo $? 0
  10. I am tring to understand what a "zero lenght" or non zero length string" string would be. That seems to be a string with no characters, but then it would be nothing example [ -n $TEST ] [ -z $VAR ]
  11. I have heard good stuff about ubuntu, I would say go for it.
  12. wow that set command is handy. Now I am able to kind of see what is happening. I thought that $DATE would change depnding on what 'one' was set to. It does but 'one' has to be set before doing DATE=${one:-three} I was setting 'one' after using the above command. Then It has no effect one the variable DATE. So long as 'one' is not set before using DATE=${one:-three} three is substituted.
  13. Is ther a way to show(list) all set and/or exported varibles in a bash shell? edit added later// I have a substitution question. Lets say I do this shane@mainbox shane $ DATE=${one:-two} shane@mainbox shane $ echo $DATE two How would I get it to echo the value one?
  14. I am happy to have reinstalled linux. I started installing gentoo yesterday, and have a working system, with gnome, this morning. I guess I feel more at home with linux. I enjoyed my BSD experience, but really missed linux(on my main workstation). BSD is a great system, but it seems to be just a little less polished(for the desktop) then linux. In all honesty if I took the time, I could probably have worked all of the kinks out of my bsd system. Somethings were surprisingly easy on BSD: If I remember correctly installing the nvidia 3d drivers were just one simple command. Sound was also as eas
  15. not to side track your thread, I noticed you refernced the LFS book. That is a great place of knowledge. I forgot how to install grub, I am so used to gentoos ebuilds doing it for me. I first went to grubs homepage, but could not find the needed info. The LFS book told you exactly what needs to be done; it was laid out in a very simple easy to follow method. http://lfs.osuosl.org/lfs/view/6.0/
  16. I see ;-) none the less, I will try to be more POSIX complient.
  17. if that is true, why does it run on my bsd box which is using true /bin/sh?
  18. for portability, I used #!/bin/sh instead of #!/bin/bash . This way the script shuld run on a bsd box that does not have bash installed. Linux just makes a link form /bin/sh to /bin/bash, but...... I got my script to work on my linux box by changeing #!/bin/sh to #!/bin/bash , how could that be? Why should that make any difference?
  19. I wrote this revised script on my bsd workstation. It seems to run well #!/bin/sh check-nfs () { echo "checking" mount | grep 192.168.1 > /dev/null if [ "$?" = 0 ] then echo "NFS is mounted" return 0 else echo "NFS is not mounted" return 1 fi } mount-nfs () { echo "mounting NFS" mount -t nfs 192.168.1.104:/mnt/media /home/shane/freevo } run-unison () { echo "preparing to run unison" /usr/local/bin/unison -version exit 0 } echo "NFS needs to be mounted before sycing can begin" check-nfs if [ "$?" = 0 ] then run-unison else mount-nfs check-nfs fi if [ "$?" = 0 ] the
  20. return was what I was looking for, Thanks :-) I originally tried to use some other ways that did not work. I will give you guys something to chuckle at here are some failed attemps: check-nfs () { echo "checking" mount | grep 192.168.1 > /dev/null if [ "$?" = 0 ] then echo "NFS is mounted" exit 0 #this gave me the correct return, but had the negative effect of stoping my script else echo "NFS is not mounted" exit 1 fi } I also tried this, I was just reaching for anything that might work ;-) check-nfs () { echo "checking" mount | grep 192.168.1 > /dev/null if [ "$?" = 0 ]
  21. I want to use this function in my bash script check-nfs () { echo "checking" mount | grep 192.168.1 > /dev/null if [ "$?" = 0 ] then echo "NFS is mounted" else echo "NFS is not mounted" fi } depending on the output either "NFS is mounted" or "NFS is not mounted" how could i use that output as a condition in an other if else statement? Sorry if this is not clear.
  22. that is what I originally was trying to do(originally I was using a function), but things were not flowing correctly. The more I tried to fix it, the more ugly it got. So I scrapped everything and started fresh, and came out with the code listed above.
  23. this line produces output to my shell, which I do not want. Is there a way to keep this line from making output mount | grep 192.168.1 edit added later/ I just piped it like this, this seems like an ok solution mount | grep 192.168.1 | if [ "$?" != 0 ];
  24. I decided to make a script that would mount my nfs share before running unison. This way I wont ever forget to mount it. I think that would screw up my syncing. Thanks for the help(iccaros and jcl), this is my first attempt at programming(term used very loosely) #!/bin/sh mount | grep 192.168.1 if [ "$?" != 0 ]; then echo "mounting nfs share" mount_nfs 192.168.1.104:/mnt/media /home/shane/freevo else echo "nfs already mounted, proceeding to sync your servers" fi mount | grep 192.168.1 if [ "$?" = 0 ] then echo "preparing to run unison" # the following line gives the command to syn
  25. this program, unison, is really cool. It can sync servers on you local system using NFS. It can also sync servers remotely by tunneling using ssh. It also works across platforms window to linux. Another neat feature unlike rysync, you can make changes to either server(not the master server only) then the changes will get updated to the other server. I am still working out some bugs, but I am pretty sure it will work like it is supposed to.