mikeizbicki / ucr-cs100

open source software construction course
Other
485 stars 407 forks source link

Adding executables into $PATH #88

Closed rgosh001 closed 10 years ago

rgosh001 commented 10 years ago

Hey Everyone, I've been trying to add my own versions of "ls" and "cp" (which is in my bin folder, which is in my home directory) by adding it's path into my $PATH variable. At first it didn't work for my macbook so i ssh'd into well to try to see if it'll work but it still won't work. Has anyone else had success with this? @mikeizbicki this is probably understood by you more since we talked about this earlier. Sorry for tagging you if I shouldn't have. My "make install" consist of the following:

#flags for compling from hw specs
CFLAS = -Wall -Werror -ansi -pedantic

all: rshell hw3-rshell ls old_rshell

install: all
    export PATH="~/bin:$(PATH)"
    cp -a ./bin ~/

rshell:
    ([ ! -d bin ] && mkdir bin) || [ -d bin ]
    g++ $(CFLAGS) src/path.cpp  -o bin/rshell

hw3-rshell:
    g++ $(CFLAGS) src/hw3.cpp  -o bin/hw3-rshell

old_rshell:
    g++ $(CFLAGS) src/main.cpp  -o bin/og_rshell

ls:
    g++ $(CFLAGS) src/ls.cpp  -o bin/ls

clean:
    rm -rf bin
    rm -rf ~/bin
rgosh001 commented 10 years ago

Also, if I do it via the command line with the EXACT text as my Makefile, it will add the path of my bin folder into the $PATH variable

mikeizbicki commented 10 years ago

Don't worry about the make install part of the assignment. I'm going to cancel it for this session, and write up a better description for future sessions. It's not important enough for you to be spending very much time on.

rgosh001 commented 10 years ago

Oh okay, So I don't have to worry about being able to use my own version of ls and cp then, correct?

mikeizbicki commented 10 years ago

Using your own would be a great way to demonstrate that you're correctly inspecting and using the PATH variable. But you don't have to set the path from the Makefile.