Re: Can I add a command in bash that starts when I open it?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Mike Hoy
Date:  
To: Main PLUG discussion list
Subject: Re: Can I add a command in bash that starts when I open it?
Thanks I'll give this a try when I get home from work. Stuck on
windoze box at work.

On Fri, Oct 24, 2008 at 10:52 AM, Lisa Kachold <> wrote:
> Yes,
>
> Just add it to the end of your .bash_profile
> Should you want ALL USERS to have these great functions you create, you
> would edit the /etc/profile (optimally /etc/profile.local since the regular
> /etc/profile global profile file will be updated with patches, etc. yet the
> local file is for optimizations.
>
> Here's what it looks like when you can define it:
>
> function temp( ) { cat /proc/acpi/thermal_zone/THRM/temperature; }
>
> Here's some other great .bash_profile (or .bashrc) toys:
>
> function calc() { echo "$*" | bc; }
> function mktar() { tar czf "${1%%/}.tar.gz" "${1%%/}/"; }
> function mkmine() { sudo chown -R ${USER} ${1:-.}; }
>
> function newmail()
> {
>     tot=0
>     for mb in $MAIL/*; do
>         cnt=`ls -1 $mb/new/|wc -l`
>         tot=`expr $tot + $cnt`
>         echo "$(basename $mb):$cnt"
>     done
>     echo "Total:$tot"
> }

>
> # sanitize - set file/directory owner and permissions to normal values
> (644/755)
> # Usage: sanitize <file>
> sanitize() {
>     chmod -R u=rwX,go=rX "$@"
>     chown -R ${USER}.users "$@"
> }

>
> then the last line would be where you invoke it:
> temp
>
> Reference:
> http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/getting-started-guide/s1-q-and-a-starting.html
>
> http://wapedia.mobi/en/Obnosis |
> http://en.wiktionary.org/wiki/Citations:obnosis | Obnosis.com (503)754-4452
> ________________________________
> ________________________________
>> From:
>> To:
>> Subject: Re: Can I add a command in bash that starts when I open it?
>> Date: Thu, 23 Oct 2008 22:36:26 -0700
>>
>> On Thursday 23 October 2008 22:16:46 Mike Hoy wrote:
>> > Just out of curiosity can I have a command execute when I open command
>> > line?
>> >
>> > Thought I would have:
>> >
>> > cat /proc/acpi/thermal_zone/THRM/temperature
>> >
>> > start up each time I opened it so I could check my temperature
>> > regularly.
>> >
>> > I searched for the answer and the closest answer I got was putting it
>> > in /etc/rc.local, but that didn't work.
>> >
>> > Thanks,
>> >
>> > Mike Hoy
>> > ---------------------------------------------------
>> > PLUG-discuss mailing list -
>> > To subscribe, unsubscribe, or to change your mail settings:
>> > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>>
>>
>>
>> Simple. Add that command to your .bashrc file. Some shells use .profile
>> instead. Play around with that.
>>
>> echo cat /proc/acpi/thermal_zone/THRM/temperature >> .bashrc
>>
>> nathan
>> ---------------------------------------------------
>> PLUG-discuss mailing list -
>> To subscribe, unsubscribe, or to change your mail settings:
>> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>
> ________________________________
> Stay organized with simple drag and drop from Windows Live Hotmail. Try it
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>




--
Mike Hoy
Saguaro Sports
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss