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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:32:01+00:00 2026-05-26T13:32:01+00:00

In a bash script called through shell in some directory ($PWD), there is a

  • 0

In a bash script called through shell in some directory ($PWD), there is a line where I need to call an executable located at $PWD/bin so that it reads a input file located at $PWD/inputfiles and the resulting output files are stored in $PWD/output.

Can this be achieved?

PS: Now if I am at

cd /home/user

I do

./run config.inp output.dat

with config.inp being at /home/user

config.inp reads files data.txt and lines.txt which are in the same directory.

Now I want to read from /home/user/input and write the output files to /home/user/output

and I try

./run input/config.inp

it says

error, data.txt not found
  • 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-26T13:32:01+00:00Added an answer on May 26, 2026 at 1:32 pm

    As the problem is described, this will do it:

    bin/executable < inputfiles/input > output/output
    

    If the problem is really that bin/executable creates files in the current directory without allowing the user to specify the input and output files, then it will be a little more complicated. What you would probably want to do instead is:

    cd output
    ln -s ../inputfiles/input
    ../bin/executable
    rm input
    

    This will create a symbolic link to inputfiles/input from within the output directory, and then delete it later. If you want to eliminate the chance of collisions with files in the output directory, then you need to create a temporary directory with something like TMPDIR = $(mktemp -d), do everything there, and then copy it back to $OLDPWD/output.

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

Sidebar

Related Questions

Let's say I've got a shell script called print_error.sh looking like this: #!/usr/bin/bash echo
Let's say I have a Bash script called foo.sh . I'd like to call
I'm trying to change directory in a called bash script. For this I tried
In a bash script that is called with sudo i am calling: /usr/bin/firefox -new-tab
I have a script called a.sh , contents of which are: //a.sh: #!/bin/bash temp=0
I need some advice on a simple bash script. I want to start around
I have this script called test.sh: #!/bin/bash STR = Hello World echo $STR when
When executing a bash script located on my FUSE filesystem, an open() call is
I have a script in Bash called Script.sh that needs to know its own
Linux bash script: #!/bin/bash function Print() { echo $1 } var=* Print $var Execution

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.