00:55.25 | *** join/#byumug wps (n=wps@65.73.113.199) |
00:55.25 | *** mode/#byumug [+o wps] by ChanServ |
04:10.17 | *** join/#byumug dna3e8 (n=dna3e8@128.187.168.196) |
04:12.30 | dna3e8 | sup |
04:12.48 | dna3e8 | So there is a happy meeting feb 3 as 4pm... |
04:13.33 | dna3e8 | It is not on the BYUMUG calander... http://ical.mac.com/drewbono/BYUMUG.ics |
15:21.06 | *** join/#byumug wps (n=wps@38.119.178.10) |
15:21.06 | *** mode/#byumug [+o wps] by ChanServ |
16:10.35 | *** join/#byumug feutetejsd (n=ned@charon.thna.net) |
17:11.57 | wps | how do I check what version I have of a command line app? |
17:12.21 | feutetejsd | depends on the app...some are command -v |
17:12.24 | feutetejsd | some are command --version |
17:12.27 | feutetejsd | some are command -V |
17:12.50 | feutetejsd | what app is it? |
17:13.00 | wps | thanks |
17:13.01 | wps | rsync |
17:13.03 | wps | -v worked |
17:13.22 | wps | --version is less verbose |
17:13.28 | feutetejsd | coo |
17:14.57 | feutetejsd | with rsync, saying rsync --help also gives version information as well as a brief description of options |
17:50.55 | wps | feutetejsd: I just compiled a new, patched, version of rsync |
17:51.03 | wps | apple's default version is in /usr/bin |
17:51.05 | feutetejsd | cool |
17:51.12 | wps | i put my new version in /usr/local/bin |
17:51.31 | wps | how do I change things so that when I type "rsync" in the command line, it uses the new version? |
17:51.53 | wps | just with an alias in .bash_profile? |
17:52.21 | feutetejsd | I would either mv /usr/bin/rsync /usr/bin/rsyncAPPLE and then mv /usr/local/bin/rsync /usr/bin |
17:52.53 | wps | or? |
17:53.01 | feutetejsd | well, I honestly guess that's all I would do....I don't have much of an "or" |
17:53.07 | wps | :) |
17:53.30 | feutetejsd | unless you want to monkey with $PATH so that /usr/local/bin comes first |
17:55.35 | wps | no, no monkeying |
17:56.02 | feutetejsd | ok, then I'd backup the apple version and put the new one in /usr/bin |
17:56.07 | wps | done |
17:56.39 | wps | testing now |
17:56.45 | feutetejsd | cool |
18:09.11 | wps | it works! |
18:09.23 | feutetejsd | nice |
18:09.25 | feutetejsd | hooray!!! |
18:10.06 | feutetejsd | hooray for OSS!!! |
18:13.47 | wps | this is awesome |
18:13.54 | wps | now I can have an automated system |
18:14.00 | wps | I have been backing everything up manually each week |
18:14.08 | wps | now with launchd, I can have it run every night |
18:14.13 | feutetejsd | sweet |
20:23.18 | wps | what's the difference between /bin/bash and /bin/sh ? |
20:26.02 | feutetejsd | actually, on my system, they are the same |
20:26.08 | feutetejsd | md5sums are exactly the same |
20:27.09 | wps | and to run a script, you have to type "perl <scriptname>" unless it's in your path or you have an alias, right? |
20:28.00 | feutetejsd | well, if it's executable, and the first line of the script tells where to find the binary, you can run it like this: |
20:28.04 | feutetejsd | ./scriptname.pl |
20:28.21 | feutetejsd | if the first line says : #!/usr/bin/perl |
20:28.49 | feutetejsd | or /path/to/script.sh |
20:28.54 | feutetejsd | if the first line is #!/bin/sh |
20:28.55 | wps | what is .sh? |
20:29.00 | feutetejsd | shell script |
20:29.01 | wps | a script full of terminal commands? |
20:29.04 | feutetejsd | more or less |
20:29.17 | wps | first line is /bin/bash |
20:29.27 | feutetejsd | yeah, that'll do too |
20:29.41 | wps | so, ./<scriptname>.sh is how you run it? |
20:30.20 | feutetejsd | yes, if the script is executable, or you can do sh <scriptname>.sh either way should work fine |
20:30.44 | wps | sh <scriptname> if it's _not_ executable? |
20:30.50 | feutetejsd | right |
20:31.33 | wps | thanks |
20:32.13 | feutetejsd | np |
21:17.20 | wps | http://pastebin.com/534370 |
21:17.29 | wps | I am getting an error when I run that script |
21:17.41 | wps | ./test: line 9: syntax error: unexpected end of file |
21:17.49 | wps | do you know what I need? |
21:17.56 | feutetejsd | stand by |
21:24.29 | feutetejsd | i think this might be the ticket....BTW, shell scripting is VERY finnicky |
21:24.31 | feutetejsd | #!/bin/sh |
21:24.31 | feutetejsd | echo "Hello, $1!" |
21:24.32 | feutetejsd | if [ $2 = "well" ]; then |
21:24.32 | feutetejsd | <PROTECTED> |
21:24.35 | feutetejsd | fi |
21:24.54 | wps | what's that? |
21:25.00 | wps | <PROTECTED> |
21:25.06 | feutetejsd | it's your script |
21:25.21 | feutetejsd | with a few tweaks |
21:25.53 | wps | right… you put a "fi" on the last line? I've never seen that syntax before. |
21:26.04 | feutetejsd | welcome to shell scripting |
21:26.10 | wps | k |
21:26.11 | wps | thanks |
21:26.31 | feutetejsd | also removed () and {} and replaced with [] instead of () and then a semicolon and "then" |
21:27.17 | feutetejsd | also note that there is a space between [ and $2 and again between "well" and ] |
21:27.22 | feutetejsd | those spaces are important |
21:27.57 | feutetejsd | and finally, you use a single = for string comparisons ...and I believe a -eq for int comparsons |
21:28.37 | feutetejsd | good times, eh? shell scripting is all kinds of useful, but it's very unforgiving |
21:28.51 | wps | ick |
21:30.30 | *** join/#byumug ChanServ (ChanServ@services.) |
21:30.30 | *** mode/#byumug [+o ChanServ] by irc.freenode.net |
21:44.05 | dna3e8 | The happy MUG meeting is not on the BYUMUG iCal calendar.... http://ical.mac.com/drewbono/BYUMUG.ics |
21:45.15 | wps | send a note to Andrew |
21:45.28 | wps | he maintains it |