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

The Archive Base Latest Questions

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

I was using a quick and dirty BASH script to automate a CF partitioning

  • 0

I was using a quick and dirty BASH script to automate a CF partitioning process.
This worked well until I wanted to add to it.

Basically, I have a script which partitions a compact flash as such:

CMD=.fdisk
DEV=/dev/sdc

echo "Calculating partition sizes..."
P1SIZE=+1100M
P2SIZE=+1200M

echo "Creating instruction file..."
PT1="n p 1\n $P1SIZE"
PT2="n p 2\n $P2SIZE"
END="a 1 w EOF\n"

[ -e $CMD ] && rm -rf $CMD

for i in $PT1 $PT2 $END; do echo -e $i >> $CMD; done

echo "Creating partitions..."
fdisk $DEV << EOF < $CMD
[ -e $CMD ] && rm -f $CMD

The idea is that in the future the file represented by ‘$CMD’ will be created automatically by an external tool with the proper start and end values. Right now I simply accept the default start and provide a size.

This worked quite well until I wanted to incorporate a few additional steps to my script. But I got into problems when I noticed weird behaviors.

The first is that if I add the code above inside a function, I will keep getting a script error:

line XX: syntax error: unexpected end of file

Also, I realized that any additional code after the ‘fdisk’ command will not execute and the script seems to simply terminate (without errors, $? = 0).

Does anyone know why the function doesn’t work and the script terminates?

  • 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-18T08:08:37+00:00Added an answer on May 18, 2026 at 8:08 am

    You’ve started a heredoc (<< EOF), but you never end it anywhere.

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

Sidebar

Related Questions

I am batch converting some pictures with a quick and dirty bash script using
I put together this quick carousel that I'm using to cycle through different divs
I'm using JAXB for quick-and-dirty XML generation. I have a class that represents a
I'm hacking a quick and dirty python script to generate some reports as static
I have been trying to whip up a quick and dirty application. This application
I'm putting together a quick and dirty animation using swing. I would like the
I'm asking this questions out of curiostity, since my quick and dirty implementation seems
Is there a quick and dirty way of using a query passed as follows:
I'm using a built-in benchmarking module for some quick and dirty tests. It gives
Using the tutorial Find Stuff (quick and Dirty) in Advance Rails Recipes, I can

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.