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

  • Home
  • SEARCH
  • 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 8924389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:23:55+00:00 2026-06-15T07:23:55+00:00

Essentially, I have a standard format for file naming conventions. It breaks down to

  • 0

Essentially, I have a standard format for file naming conventions. It breaks down to this:

target_dateUTC_timeUTC_tool

So, for instance, if I run tcpdump on a target of ‘foo’, then the file would be foo_dateUTC_timeUTC_tcpdump. Simple enough, but a pain for everyone to constantly (and consistently) enter… so I’ve tried to create a bash script which sets system variables like so:

FILENAME=$TARGET\_$UTCTIME\_$TOOL

Then, I can just call the variable at runtime, like so:

tcpdump -w $FILENAME.lpc

All of this works like a champ. I’ve got a menu-driven .sh which gives the user the options of viewing the current variables as well as setting them… file generation is a breeze. Unfortunately, by setting the date/time variable, it is locked to the value at the time of creation (naturally). I set the variable like so:

UTCTIME=$(/bin/date --utc +"%Y%m%d_%H%M%Z")

What I really need is either a way to create a variable which updates at runtime, or (more likely) another way to skin this cat.

While scouring for solutions, I came across a similar issues… like this.

But, to be honest, I’m stumped on how to marry the two approaches and create a simple, distributable solution.

.sh file is posted via pastebin, here.

  • 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-06-15T07:23:57+00:00Added an answer on June 15, 2026 at 7:23 am

    Use a function:

    generate_filename() { echo "${1}_$(/bin/date --utc +"%Y%m%d_%H%M%Z")_$2"; }
    

    And use it like this:

    tcpdump -w "$(generate_filename foo tcpdump).lpc"
    

    It’s hard to get the function to automatically determine the command name. You can use bash history to get it and save a couple of characters typing:

    tcpdump -w "$(generate_filename foo !#:0).lpc"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First i was wondering if this is a good idea, essentially i have user
This seems like the model binding is causing me issues. Essentially I have a
I have a question with whether or not this is a standard for using
Essentially, I have to get a flat file into a database. The flat files
I have to work with this library that deals with a standard for biodiversity.
I have a pretty standard Spring 3.0.7 web app The structure is like this
Essentially I have a method of a class called killProgram, which is intended to
Essentially I have an NSMutableArray which contains several NSDictionaries . I wish to sort
Essentially I have a script which acts as a task wrapper and emails a
I have essentially the same problem discussed here: http://khason.net/blog/dependency-property-getters-and-setters-in-multithreaded-environment/ public static readonly DependencyProperty MyPropertyProperty

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.