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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:36:27+00:00 2026-05-18T00:36:27+00:00

I tried to run a command by reading it from a textfile, but it

  • 0

I tried to run a command by reading it from a textfile, but it failed. when i enter the exact same line it is working, tough. im suprised that it did even try to execute the move command, but got an errormessage that translates to “File or directory not found”. obviously the errormessage is not telling the truth here. can someone explain that?

s39339@compute:~/spr/man/de$ head -n7 mkdoc|tail -n1
mv nutzer.1.gz ~/public_html/man/man1/
s39339@compute:~/spr/man/de$ `head -n7 mkdoc|tail -n1`
mv: Verschieben von „nutzer.1.gz“ nach „~/public_html/man/man1/“ nicht möglich: Datei oder Verzeichnis nicht gefunden
s39339@compute:~/spr/man/de$ ls
gzip  mkdoc  nutzer.1  nutzer.1.gz  nutzer.pod  rbsh
s39339@compute:~/spr/man/de$ mv nutzer.1.gz ~/public_html/man/man1/
s39339@compute:~/spr/man/de$

I am doin this for school so an answer would be nice. the way we get to our results doesn’t matter, although what i tried seems way unnessecary.

  • 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-18T00:36:27+00:00Added an answer on May 18, 2026 at 12:36 am

    `head -n7 mkdoc|tail -n1` is replaced by the output of the command, which is mv nutzer.1.gz ~/public_html/man/man1/. This output is then interpreted as a command, a mv command.

    It fails, though, because tilde expansion has already been performed. ~ is not substituted with your home directory at this point; it’s just a plain tilde character. It’s as if you had tried to execute

    'mv' 'nutzer.1.gz' '~/public_html/man/man1/'
    

    For the same reason you cannot use $HOME, or a second set of backticks, or any other dynamic construct. To do that you will need to use eval, or pass the string to a second shell.

    eval `head -n7 mkdoc|tail -n1`
    bash -c "`head -n7 mkdoc|tail -n1`"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried the following command on my SVN Repository to clone only a
Sometimes I have to run a command many times in succession, for example to
I'm trying to make Vim run the command 'CommandTFlush' whenever a new file is
I have the rake tasks in my rails application. i want to run a
I have the rake tasks in my rails application. i want to run a
I have a batch file that I have been using to install my C#
I was wondering if anyone knew how to use a console file in c#.
I am trying to find out filetypes using c code, here is the code
I'm having a weird issue with my Silverlight 4 project, although it's one I've
I'm not really sure why the following console application doesn't produce the expected behavior

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.