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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:20:53+00:00 2026-05-23T17:20:53+00:00

I need to do a script to extract a tar at a specified location.

  • 0

I need to do a script to extract a tar at a specified location.

I did something simple like:

cp test.tar /var/www/html
cd /var/www/html
tar xvf test.tar

If I execute the commands by hand everything is OK. If I save them in a .sh then use #bash script.sh, I get the following error “: Not a directory cd: /var/www/html”. Any ideea why?

Ty for your time.

Notes: I tried the script version on a virtual machine (CentOS 5.5) and the script worked fine, the problem occurs on the real machine where I want to use it (I used same OS disk image, same configurations as on the virtual machine… this makes it really really odd for me).

Added: Also I try invoking something like service mysqld start… this also fails saying that a dir doesn’t exist (still if I run by hand it works.).

  • 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-23T17:20:54+00:00Added an answer on May 23, 2026 at 5:20 pm

    I solved the problem – it is quite interesting).

    I created the script on a virtual machine running on windows with a centos os, the enter in windows is “\r\n” while in linux is “\n”.

    The script worked on the vm because the code for enter was correct, while on the second computer, with native linux it was incorrect. I created exactly the same script on linux and everything went back 2 normal ;).

    Note… the mkdir part worked because I used another, simplified script written on linux.

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

Sidebar

Related Questions

Ok guys.. I have a HTML i need to parse into a php script
I have a simple script where I am fetching an HTML page, passing it
We have a need to parse and extract the content from html files. We
In my bash script I need to extract just the path from the given
I need to extract large amounts of data from a variety of HTML files,
I want to extract data from HTML table using Python script and save it
I need a simple script to run in Windows that searches large xml files
I need to extract this line of code from a script i am retrieving
I need to generate multiple databases to SQL, so I need script/program to automatically
I need to script the creation of app pools and websites on IIS 6.0.

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.