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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:35:55+00:00 2026-06-01T07:35:55+00:00

I have some status text displayed in a BASH script, e.g.: Removed file sandwich.txt.

  • 0

I have some status text displayed in a BASH script, e.g.:

Removed file "sandwich.txt". (1/2)
Removed file "fish.txt". (2/2)

I would like to have the progress text (1/2) appear entirely to the right, lined up with the edge of the terminal window, e.g.:

Removed file "sandwich.txt".                           (1/2)
Removed file "fish.txt".                               (2/2)

I have tried solutions at right align/pad numbers in bash and right text align – bash, however, the solutions do no seem to work, they just make a large white space, e.g.:

Removed file "sandwich.txt".                           (1/2)
Removed file "fish.txt".                           (2/2)

How can I have some of the text left aligned and some of the text right aligned?

  • 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-06-01T07:35:57+00:00Added an answer on June 1, 2026 at 7:35 am
    printf "Removed file %-64s (%d/%d)\n" "\"$file\"" $n $of
    

    The double quotes around the file name are eclectic, but get the file name enclosed in double quotes to the printf() command, which will then print that name left justified in a field of width 64.

    Adjust to suit.

    $ file=sandwich.txt; n=1; of=2
    $ printf "Removed file %-64s (%d/%d)\n" "\"$file\"" $n $of
    Removed file "sandwich.txt"                                                   (1/2)
    $
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data, like this: BUG DATE STATUS ---- ---------------------- -------- 9012 18/03/2008
I have one text field where user can write short message (like status on
I have some 10 buttons with image-text and hover states for each. What I
I have some code as shown below: - (IBAction)startButtonPressed:(id)sender { statusText.text = @Processing...; //here
In my app I have need to trigger show some custom view when status
I have a list of states, each with some data associated with it, displayed
I have a list adapter that handles objects with some image and text and
I have an object where the text cycles and displays status messages. When the
xxxi have the_title() that returns some text, in this case Blue & Whiny the
I have some trouble showing/hiding this menu on mouse enter. I'd like the menu

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.