PDA

View Full Version : bah, a command line problem




shadowfax
Aug 27, 2003, 04:33 PM
say, i am taking a discrete math course for CS here at college, and we had to install a program called hugs98... they have macOS binaries; it's a .pkg that installs the program to /usr/local/bin. i would like to be able to just open the terminal and type ./hugs to run this program, but it doesn't work. i have to cd into /usr/local/bin before ./hugs works. how would i go about making it work from anywhere?



mc68k
Aug 27, 2003, 04:55 PM
sounds like haskell...ewww :eek:

good luck with functional programming :)

add /usr/local/bin to $PATH like thissetenv PATH /usr/local/bin:$PATHsee if that works

to check if it's in ur path typeecho $PATH

shadowfax
Aug 27, 2003, 05:07 PM
Originally posted by mc68k
sounds like haskell...ewww :eek:

good luck with functional programming :) cool, that worked. apparently it put in a manual entry for the thing too, but "man hugs" isn't doing anything for me. i dunno if that matters at all--it says it put it in /usr/local/man/man1... any ideas on that?

haskell looks odd; this program is kinda fun to play around with, but i don't see the point at all, so far.

zimv20
Aug 27, 2003, 05:10 PM
Originally posted by shadowfax
cool, that worked. apparently it put in a manual entry for the thing too, but "man hugs" isn't doing anything for me. i dunno if that matters at all--it says it put it in /usr/local/man/man1... any ideas on that?


set MANPATH similar to how you set PATH above

shadowfax
Aug 27, 2003, 05:13 PM
Originally posted by zimv20
set MANPATH similar to how you set PATH above haha, wow, i should have guessed. i just couldn't guess just what the alias for it (MANPATH) would be. that's cool to know.

thanks, you guys are great. that was like 5 minutes, lol.

mc68k
Aug 27, 2003, 05:18 PM
i was tipped off by rower_cpu (my boss)

shadowfax
Aug 27, 2003, 05:21 PM
well, the MANPATH thing did work (according to echo $MANPATH), but "man hugs" isn't doing anything for me. i blame the programmers.

although there is a /usr/local/man/man1/hugs.1 file there, says terminal. humbug!

edit: no worries on this of course: who RTFMs these days, anyway? i'll just bitch at my prof.

zimv20
Aug 27, 2003, 05:44 PM
Originally posted by shadowfax
well, the MANPATH thing did work (according to echo $MANPATH), but "man hugs" isn't doing anything for me.

ruh-roh.

execute the following and report back, please:

% echo $MANPATH
% manpath


also, in which file did you set the MANPATH and did you start a new terminal window before 'man hugs'?

shadowfax
Aug 27, 2003, 05:46 PM
Originally posted by zimv20
ruh-roh.

execute the following and report back, please:

% echo $MANPATH
% manpath


also, in which file did you set the MANPATH and did you start a new terminal window before 'man hugs'? [walker1-106:~] mithrandir% echo $MANPATH
/sw/share/man:/usr/share/man:/usr/X11R6/man

so says the man in the terminal. wow, that's weird, i ran it a few min ago and it had the one i put in there... i think...

edit: aha! it all went away when i opened a new terminal session. the $PATH stuff too. how do i make it permanent?

kylos
Aug 27, 2003, 05:48 PM
I'm actually taking Haskell as a 400 level class. My prof was mentioning that more colleges are offering it as a first year class in England. I guess they're doing it here as well. If you're familiar with a more standard language Haskell has the potential to confuse you. Once you get past the functional stuff (which is actually very nice to use, you can write in two or three lines what might take 20 or 30 in C or Java) and get into I/O you'll be pulling your hair out. Incidentally, my prof says I/O in Haskell is much more well implemented than in previous functional languages. Anyhow, good luck with Haskell.

zimv20
Aug 27, 2003, 06:01 PM
Originally posted by shadowfax

edit: aha! it all went away when i opened a new terminal session. the $PATH stuff too. how do i make it permanent?

stick it in your .login. here's my PATH line(s):

setenv MYSQL_PATH /Developer/MySQL/mysql-3.23.54a-apple-darwin6.1-powerpc
setenv PATH .:/usr/local/bin:${PATH}:${HOME}/bin:${MYSQL_PATH}/bin


i'm not sure of the relationship between the manpath command and the MANPATH environment variable. there may be an extra step to getting the man stuff to work.

shadowfax
Aug 27, 2003, 06:10 PM
Originally posted by zimv20
stick it in your .login. here's my PATH line(s):

setenv MYSQL_PATH /Developer/MySQL/mysql-3.23.54a-apple-darwin6.1-powerpc
setenv PATH .:/usr/local/bin:${PATH}:${HOME}/bin:${MYSQL_PATH}/bin


i'm not sure of the relationship between the manpath command and the MANPATH environment variable. there may be an extra step to getting the man stuff to work. is .login a file that goes in ~/? i don't seem to have one there. should i just make one?

kylos
Aug 27, 2003, 09:07 PM
You should have a .login file in ~/. Did you use ls -a when looking for it. Any file that begins with a . can only be viewed in a directory listing if you use the -a option.
If you're familiar with command line editing, you might as well follow that route since it's easiest to access a . file from the terminal. Optionally type "open .login" in the terminal to open the file in TextEdit.app. And if you don't have a .login file, there shouldn't be any problem creating one.

zimv20
Aug 27, 2003, 09:56 PM
Originally posted by shadowfax
is .login a file that goes in ~/? i don't seem to have one there. should i just make one?

yes and yes.

szark
Aug 27, 2003, 10:30 PM
After adding new man pages, it's a good idea to use the following sequence to rebuild the search index:

sudo find / -name man -print > manlist.txt

sudo /usr/libexec/makewhatis `paste -d":" -s manlist.txt`

The first command finds all man directories and stores the list in a file. (manlist.txt)

The second command rebuilds the search index using the list from the file.

Note that the single quotes in the second statement are "left" quotes (above the tab key on the keyboard).

zimv20
Aug 27, 2003, 10:56 PM
Originally posted by szark

sudo find / -name man -print > manlist.txt

sudo /usr/libexec/makewhatis `paste -d":" -s manlist.txt`


neat! i'd add the -type switch to the find command to avoid picking up the actual man command.

sudo find / -name man -type d -print > manlist.txt

shadowfax
Aug 27, 2003, 11:23 PM
Originally posted by Kyle?
You should have a .login file in ~/. Did you use ls -a when looking for it. Any file that begins with a . can only be viewed in a directory listing if you use the -a option.
If you're familiar with command line editing, you might as well follow that route since it's easiest to access a . file from the terminal. Optionally type "open .login" in the terminal to open the file in TextEdit.app. And if you don't have a .login file, there shouldn't be any problem creating one. yeah, i got the whole thing about the .* files with X11 and the whole "make a .xinitrc file" thing. regardless, i have no .login to my name. i didn't make one either, i went to the cshrc.login file and added them there...

szark, i don't really understand what your code is doing on a syntactical basis... where do i put in the "hugs" thing? or do i not need to, will it then go to all the manpath directories i have set and find all the manpages? sorry, i have extensive basic terminal experience, and literally almost no experience with nuances like this :)

zimv20
Aug 27, 2003, 11:28 PM
Originally posted by shadowfax
where do i put in the "hugs" thing? or do i not need to, will it then go to all the manpath directories i have set and find all the manpages?

the find command will pick up all the installed man pages.

btw, if you've ever done an archive install, that find command will pick up the man pages in there. not sure what'll happen then, when you issue the man command. two man pages to show you?

if you do, then add this command before running the makewhatis:

% grep -v 'Previous Systems' manlist.txt > manlist2.txt


then use manlist2.txt in the makewhatis command, of course.

zimv20
Aug 27, 2003, 11:40 PM
nuts to all that. let's make one big command w/ pipes! make it easier on yourself and login as root, then:

# find / -name man -type d -print | grep -v 'Previous Systems' | paste -d":" -s - | makewhatis

shadowfax
Aug 27, 2003, 11:51 PM
aaaaah! quick! someone stop them before i switch to a humanities major!

zimv20
Aug 28, 2003, 12:36 AM
Originally posted by shadowfax
aaaaah! quick! someone stop them before i switch to a humanities major!

no! PIPE! YOU MUST PIPE!!!!

szark
Aug 28, 2003, 12:41 AM
Originally posted by zimv20
neat! i'd add the -type switch to the find command to avoid picking up the actual man command.

sudo find / -name man -type d -print > manlist.txt


Damn! Knew I forgot something... :)

mv ~/CS/major ~/Humanities/major

:D

zimv20
Aug 28, 2003, 12:59 AM
Originally posted by szark

mv ~/CS/major ~/Humanities/major


cp ~/CS/major ~/Humanities/major

ooh. now my brain hurts.

shadowfax
Aug 28, 2003, 08:50 AM
Originally posted by zimv20
cp ~/CS/major ~/Humanities/major

ooh. now my brain hurts. wait, so now i am double majoring? whaaa?

excuse me while i take my life in an elevator shaft.

kylos
Aug 28, 2003, 10:12 AM
rm -r /'elevator shaft'/shadowfax

There. That should do it for ya.:)

Powerbook G5
Aug 28, 2003, 08:24 PM
Originally posted by shadowfax
cool, that worked. apparently it put in a manual entry for the thing too, but "man hugs" isn't doing anything for me.

I'm sorry, but I have to say it...I sure hope that man hugs don't do it for you! :p

shadowfax
Aug 28, 2003, 08:55 PM
"President Bush, i just have to ask... do you think you'll ever have a mandate?"

"No, Conan, i'm afraid i don't go in for that sort of thing...ok, ok, once, when i was in college, but we didn't make it past first base, i swear!"

or something