/* ******** home command ******** The 'home'command takes you to your home directory if you've been wandering far, and don't want to type so much. Just type "home" at the shell, and you're immediatly transported to /home/yourusername/
>> On 24 Jan 2004 17:49:42 -0800, >> mikecoxli...@yahoo.com (Mike Cox) said: > /* ******** home command ******** The 'home'command takes > you to your home directory if you've been wandering far, and > don't want to type so much. Just type "home" at the shell, > and you're immediatly transported to /home/yourusername/
"home" is shorter than "cd"?
And how does a child process affect its parent's environment?
String constants like "/home/" aren't guaranteed to be in writable memory. If it is, you've just trashed whatever followed it. You want this:
char * base = new char[name_len + 7]; strcpy( base, "/home/" ); strcat( base, name );
But wait...what is the point of the "name" variable?
char * base = new char[name_len + 7]; strcpy( base, "/home/" ); strcat( base, login_name );
Or, doing this right and using std::string:
std::string base = "/home/" + std::string(getlogin());
> FILE* bong; > std::cout<<"going to home directory...\n"; > bong = popen(base,"w");
Oops. You left out the "cd". Change "/home/" in the earlier stuff to "cd /home/".
> pclose(bong); > }
> delete [] name; > return 0; > }
After you build this and it doesn't work, and you finally figure out why, you will feel really dumb. However, don't feel bad. Dennis Ritchie made the same mistake when he implemented the "cd" command way back on the earliest Unix that had a shell and a filesystem with directories. :-)
Mike Cox wrote: > /* > ******** home command ******** > The 'home'command takes you to your home directory if > you've been wandering far, and don't want to type so > much. Just type "home" at the shell, and you're immediatly > transported to /home/yourusername/
Mike Cox wrote: > /* > ******** home command ******** > The 'home'command takes you to your home directory if > you've been wandering far, and don't want to type so > much. Just type "home" at the shell, and you're immediatly > transported to /home/yourusername/
On Sun, 25 Jan 2004 02:15:06 GMT, Frostbite <bill.ga...@ms.com> wrote: >Mike Cox wrote:
>> /* >> ******** home command ******** >> The 'home'command takes you to your home directory if >> you've been wandering far, and don't want to type so >> much. Just type "home" at the shell, and you're immediatly >> transported to /home/yourusername/
>just type "cd", dipshit
LOL I love it when the humor-impaired "don't get it." ;-)
On 24 Jan 2004 17:49:42 -0800, Mike Cox <mikecoxli...@yahoo.com> wrote:
> /* > ******** home command ******** > The 'home'command takes you to your home directory if > you've been wandering far, and don't want to type so > much. Just type "home" at the shell, and you're immediatly > transported to /home/yourusername/
This has got to be a joke.
On every nix box I have ever seen, simply entering "cd" with no arguments takes you to your home directory.
If it didn't, then a simple function in one's ~/.bashrc (etc) would do the job:
ho () {
cd $HOME
}
Now HERE'S a useful little function.
cs () {
cd "$1" && ls -Fa
}
A combination of cd and ls. Type cs and your destination directory, and you go there AND ls is -Fa is run on the directory.
> /* > ******** home command ******** > The 'home'command takes you to your home directory if > you've been wandering far, and don't want to type so > much. Just type "home" at the shell, and you're immediatly > transported to /home/yourusername/
On Sun, 25 Jan 2004 02:46:14 GMT, Rich Webb <bbew...@mapson.nozirev.ten> wrote:
> On Sun, 25 Jan 2004 02:15:06 GMT, Frostbite <bill.ga...@ms.com> wrote:
>>Mike Cox wrote:
>>> /* >>> ******** home command ******** >>> The 'home'command takes you to your home directory if >>> you've been wandering far, and don't want to type so >>> much. Just type "home" at the shell, and you're immediatly >>> transported to /home/yourusername/
>>just type "cd", dipshit
> LOL I love it when the humor-impaired "don't get it." ;-)
We probably should have just laid back and waited for some newbie to install it....
Wouldn't it have been fun to guide them through the compilation steps? Help them create the Makefile?
:-)
(On the other hand, they'd learn a lot by doing it, so....?)
My second thought after laughing out loud was that it could be malicious code...
["Followup-To:" header set to comp.os.linux.misc.]
On 2004-01-25, Mike Cox <mikecoxli...@yahoo.com> wrote:
> /* > ******** home command ******** > The 'home'command takes you to your home directory if > you've been wandering far, and don't want to type so > much. Just type "home" at the shell, and you're immediatly > transported to /home/yourusername/
% pwd /usr/home/kkeller % cd /ive/been/wandering/far % home % pwd /ive/been/wandering/far
Works great! When's v2.0 coming out? I think you should rewrite it in assembly, so that it's more efficient.
Rich Webb <bbew...@mapson.nozirev.ten> wrote: > On Sun, 25 Jan 2004 02:15:06 GMT, Frostbite <bill.ga...@ms.com> wrote:
>>Mike Cox wrote:
>>> /* >>> ******** home command ******** >>> The 'home'command takes you to your home directory if >>> you've been wandering far, and don't want to type so >>> much. Just type "home" at the shell, and you're immediatly >>> transported to /home/yourusername/
>>just type "cd", dipshit
> LOL I love it when the humor-impaired "don't get it." ;-)
And you realize that when someone from MIT sees this, they'll upgrade it to include a mail client... -- let name="aa454" and tld="freenet.carleton.ca" in String.concat "@" [name;tld];; http://www.ntlug.org/~cbbrowne/languages.html "In order to make an apple pie from scratch, you must first create the universe." -- Carl Sagan, Cosmos
On Sun, 25 Jan 2004 at 05:15 GMT, Christopher Browne wrote: > Rich Webb <bbew...@mapson.nozirev.ten> wrote: >> On Sun, 25 Jan 2004 02:15:06 GMT, Frostbite <bill.ga...@ms.com> wrote:
>>>Mike Cox wrote:
>>>> /* >>>> ******** home command ******** >>>> The 'home'command takes you to your home directory if >>>> you've been wandering far, and don't want to type so >>>> much. Just type "home" at the shell, and you're immediatly >>>> transported to /home/yourusername/
>>>just type "cd", dipshit
>> LOL I love it when the humor-impaired "don't get it." ;-)
> And you realize that when someone from MIT sees this, they'll upgrade > it to include a mail client...
No, that should be done in shell......
-- Chris F.A. Johnson http://cfaj.freeshell.org =================================================================== My code (if any) in this post is copyright 2004, Chris F.A. Johnson and may be copied under the terms of the GNU General Public License
Mike Cox wrote: > /* > ******** home command ******** > The 'home'command takes you to your home directory if > you've been wandering far, and don't want to type so > much. Just type "home" at the shell, and you're immediatly > transported to /home/yourusername/ > }
Here are my shorter GPL versions of your home command.
Version 1 :-
alias home=cd
Version 2 :-
alias home='cd $HOME'
most systems should work with version 1, all should work with version 2.
In article <bv0hao$lth8...@ID-35459.news.uni-berlin.de>, Nigel Feltham wrote:
> Here are my shorter GPL versions of your home command.
> Version 1 :-
> alias home=cd
> Version 2 :-
> alias home='cd $HOME'
> most systems should work with version 1, all should work with version 2.
His is trying (and failing) to go to the home directory of the person who is logged into the controlling terminal of the process, which means if you login as foo, and then "su -", it should still take you to ~foo.
How about something like this function in bash?
home() { TTY=`tty | sed 's/\/dev\///'` WHOLINE=`who | grep $TTY | sed 's/ .*//'` eval cd ~$WHOLINE }
Mike Cox <mikecoxli...@yahoo.com> wrote: >/* > ******** home command ******** > The 'home'command takes you to your home directory if > you've been wandering far, and don't want to type so > much. Just type "home" at the shell, and you're immediatly > transported to /home/yourusername/
I miss the configure script, the Makefile and man file. An rpm would be nice too. Also this program doesn't follow the gnu presciptions of the --version and --help options.
An alternative is: alias home=cd
I'm glad you didn't patent your invention. I for me will keep typing cd because it saves two letters.
-- -- Albert van der Horst,Oranjestr 8,3511 RA UTRECHT,THE NETHERLANDS One man-hour to invent, One man-week to implement, One lawyer-year to patent.
>>> /* >>> ******** home command ******** >>> The 'home'command takes you to your home directory if >>> you've been wandering far, and don't want to type so >>> much. Just type "home" at the shell, and you're immediatly >>> transported to /home/yourusername/
>>just type "cd", dipshit >LOL I love it when the humor-impaired "don't get it." ;-)
It would be even more amusing to submit it to the Patent Office.
They'd probably approve it, and then IBM would contest it and show that they already patented it years ago..
On Sun, 25 Jan 2004 19:47:41 GMT, Juha Siltala <jsilt...@gmx.net> wrote:
> In article <iVTQb.26071$1e.1...@newsread2.news.pas.earthlink.net>, Alan > Connor wrote: >> On Sun, 25 Jan 2004 12:46:12 -0500, Buck Turgidson <jc...@hotmail.com> wrote:
>>>> alias home='rm -rf $HOME'
>>> I tried this, but it didn't take me to my home directory....
>> That's really baffling.
>> I'd su to another user on your system and try again.
> When something doesn't work as you expected, always try as root! It might > be a permission problem :)
Of course! <slaps head> I really do need to think these things through....
:-\
(Do you think we should tell him that rm doesn't mean "routine maintenance"?)