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 8548525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:31:02+00:00 2026-06-11T13:31:02+00:00

When I run the command date +%s directly on unix terminal, it correctly executes

  • 0

When I run the command date +%s directly on unix terminal, it correctly executes and gives number of seconds since 1970.

However, when the same command is in a script file, say temp.sh as below:

business_dt=date +%s
echo $business_dt

On executing above script, it throws error as below:

-ksh: +%s: not found [No such file or directory]

How to resolve this issue?

  • 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-11T13:31:03+00:00Added an answer on June 11, 2026 at 1:31 pm

    You need to use command substitution to assign the output of a command to a variable. The syntax is var=$(command). So, try changing your script to:

    business_dt=$(date +%s)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to run a command, that will count the number of words in
Is there any way for me to run a system command such as date
Do I have to manually run date command using child_process and fetch the result
I have this bash shell-script command that causes date to run if make succeeds
I run command: sudo apt-get install phpmyadmin to install phpMyAdmin. Then I enter address:
I was wondering is there is a way to specify to the run command
I'm obviously developing in debug mode. If I'm starting with the standard run command
To run a command on a single file, I recently realized I can do
I run this command : select * from LIST where JCODE = 8 and
When i run the command below: 127.0.0.1:8080/solr/suggest?spellcheck.build=true I got an exception as below, anyone

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.