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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:08:44+00:00 2026-05-16T12:08:44+00:00

end goal is to have the bash run something like php script.php argument1 argument2

  • 0

end goal is to have the bash run something like

php script.php argument1 argument2 argument3

however, I want to ask the user for argument1,2, and 3. which will construct the above and run it.

  • 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-16T12:08:45+00:00Added an answer on May 16, 2026 at 12:08 pm

    The read command will do the trick:

    pax> read -p 'What? ' p ; echo .${p}.
    What? hello
    .hello.
    

    For your specific purposes, you can use:

    pax> cat qq.sh
       #!/bin/bash
       read -p 'Enter argument 1: ' arg1
       read -p 'Enter argument 2: ' arg2
       read -p 'Enter argument 3: ' arg3
       echo Will run: php script.php \"${arg1}\" \"${arg2}\" \"${arg3}\"
    
    pax> ./qq.sh
       Enter argument 1: hello there
       Enter argument 2: goodbye
       Enter argument 3: once again
       Will run: php script.php "hello there" "goodbye" "once again"
    

    Use man read for further details, though it will probably give you the massive bash manpage, so I’ll duplicate the relevant section from mine here:


    read [-ers] [-u fd] [-t timeout] [-a aname] [-p prompt]
         [-n nchars] [-d delim] [name ...]
    
    One line is read from the standard input, or from the file descriptor fd
    supplied as an argument to the -u option, and the first word is assigned
    to the first name, the second word to the second name, and so on, with
    leftover words and their intervening separators assigned to the last name.
    
    If there are fewer words read from the input stream than names, the
    remaining names are assigned empty values. The characters in IFS are used
    to split the line into words. The backslash character (\) may be used to
    remove any special meaning for the next character read and for line
    continuation.
    
    Options, if supplied, have the following meanings:
    
    -a aname      The words are assigned to sequential indices of the array
                  variable aname, starting at 0. aname is unset before any new
                  values are assigned. Other name arguments are ignored.
    -d delim      The first character of delim is used to terminate the input
                  line, rather than newline.
    -e            If the standard input is coming from a terminal, readline is
                  used to obtain the line.
    -n nchars     Read returns after reading nchars characters rather than
                  waiting for a complete line of input.
    -p prompt     Display prompt on standard error, without a trailing newline,
                  before attempting to read any input. The prompt is displayed
                  only if input is coming from a terminal.
    -r            Backslash does not act as an escape character. The backslash is
                  considered to be part of the line. In  particular, a
                  backslash-newline pair may not be used as a line continuation.
    -s            Silent mode. If input is coming from a terminal, characters are
                  not echoed.
    -t timeout    Cause read to time out and return failure if a complete line of
                  input is not read within timeout seconds. This option has no
                  effect if read is not reading input from the terminal or a pipe.
    -u fd         Read input from file descriptor fd.
    
    If no names are supplied, the line read is assigned to the variable REPLY.
    The return code is zero, unless  end-of-file is encountered, read times out,
    or an invalid file descriptor is supplied as the argument to -u.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 530k
  • Answers 530k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer you need to deploy the python libraries you're referencing along… May 16, 2026 at 11:32 pm
  • Editorial Team
    Editorial Team added an answer You can encrypt the files via any number of mechanisms,… May 16, 2026 at 11:32 pm
  • Editorial Team
    Editorial Team added an answer Just add a class name of new-button to the buttons… May 16, 2026 at 11:32 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

The end goal is to have some form of a data structure that stores
I have an associative array that I want to display using TileList. However, it
I have been playing with BeautifulSoup, which is great. My end goal is to
Assume I have a database table with many names. I'd like to flex match
I have a collection of divs that contain either images or checkboxes. My end
The end goal for this post is to override the ToString() method of a
The end goal is to create a helper found at the end called show_status(contact,event).
Hi I'm not used to do things in Bash, so I'm having some problems:
This is my situation:     I have a linux server/media center with a
So I have two sortable lists in a web app I'm writing. What I

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.