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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:00:23+00:00 2026-05-25T18:00:23+00:00

I want to store a user message in a bash program, and then display

  • 0

I want to store a user message in a bash program, and then display the message the next time the user runs the script.

One way I thought this might work is if I export the message to an environmental variable, but I cannot get it to work.

Here is what I have so far, but it is not working:

echo "Last message was: $KEEPTHISMESSAGE"
echo "Type the new message that you want to enter, followed by [ENTER]:"
read KEEPTHISMESSAGE
export KEEPTHISMESSAGE

What am I doing wrong? If there is a better way to do this, please let me know. Maybe keep a file that keeps a history of these message and gets the most recent?

  • 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-25T18:00:24+00:00Added an answer on May 25, 2026 at 6:00 pm

    You cannot use EXPORT this way. It only exports to processes started from within that invocation of the script. You must store the message in a file on the filesystem and load it in the next time your user executes the script. Very simply:

    echo "Last message was: $(cat message.txt)"
    echo "Type the new message that you want to enter, followed by [ENTER]:"
    read KEEPTHISMESSAGE
    echo $KEEPTHISMESSAGE > message.txt
    

    You’ll have to work out what happens the first time (when message.txt doesn’t exist), and issues with relative/absolute paths to message.txt if you’re running the script in a different directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to get user input in one page, store that in a php
how should I store user data in asp.net mvc? Let's say a user want
I want to store data with every request (what user viewed what page of
I want to store the username/password information of my windows service 'logon as' user
I want to access an image stored in Blackberry, say at location store/home/user/image.png .
model.py: class Tribes(Group): members = models.ManyToManyField(User, related_name='tribes', verbose_name=_('members')) i want to store a number
I want to use Context.Items to store some info of a User Control like:
My User object that I want to create and store in the datastore has
I take user input into a text area, store it and eventually display it
Currently we are working with a user input of time. We want to take

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.