Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7548789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:47:16+00:00 2026-05-30T09:47:16+00:00

please rename this post if you can help me find a more accurate title.

  • 0

please rename this post if you can help me find a more accurate title.

here is what i have in my bashrc:

export currdate=`date | awk '{print $2$3}'`
loggit (){
   $0 2>&1 | tee /tmp/$currdate.logs
}

bassically i want to log the output when i run myscript.sh like this:

bash$: myscript.sh 2>&1 | tee /tmp/todaydate.logs

but i dont want to do that everytime, what i want is

bash$: myscript.sh loggit 

I dont know how to do this when the function goes after an argument so Could you help please?

UPDATE
Fixed by doing this:

loggit (){
       $1 2>&1 | tee /tmp/$currdate.logs
}

and do: (thanks to tripleee)

bash$: loggit myscript.sh
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:47:18+00:00Added an answer on May 30, 2026 at 9:47 am

    UPDATE
    Fixed by doing this:

    loggit (){
           $1 2>&1 | tee /tmp/$currdate.logs
    }
    

    and do: (thanks to tripleee)

    bash$: loggit myscript.sh
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure the title is accurate, please feel free to rename the question
Please don't question the really odd hierarchy of workers in this code here, I
Please have a look and help me out, I've been looking at my css
Please i need your help with my script. I'm trying to post comments to
PLEASE NOTE: This is a CODE QUESTION NOT AN SYSTEM MANIPULATION ONE. I have
I have this script set up or rename my torrent folders, however it keeps
Please help!!! I am using gesture recognizer to move my UIView. During moving I
Please consider this example class: [Serializable] public class SomeClass { private DateTime _SomeDateTime; public
I have a Windows Form application. What this application does, is let the user
I have faced this problem when working with ORACLE 10g. I read the answers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.