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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:26:18+00:00 2026-06-18T04:26:18+00:00

for file in `find . -name *.po` ; do msgfmt -o `echo $file |

  • 0
for file in `find . -name "*.po"` ; do msgfmt -o `echo $file | sed s/\.po/\.mo/` $file ; done

This code I found is creating multiple MO files in all subdirectories from PO files. At first time, it works well. But when I run it second time;

it shows some syntax error messages. I checked the PO files that the msgfmt is complaining but they were not existing before. They are created after running this code.

For example the file was secpolicy.po but it also created another secpolicy.po file.

What is wrong in that code?

  • 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-18T04:26:19+00:00Added an answer on June 18, 2026 at 4:26 am

    The problem is most likely with the quoting. Since you don’t quote the sed pattern, the shell interprets the backslashes and calls sed as

    sed s/.po/.mo/
    

    When you have a file named secpolicy.po, it will change it to se.molicy.po, which results in a call to

    msgfmt -o se.molicy.po secpolicy.po
    

    To fix this, change the sed to

    echo $file | sed 's/\.po$/.mo/'
    

    See the additional single quotes ' and the end of string $.

    If you have a file abc.po, it will match the dot \., the string po and finally the end of line $, and then replace this match with .mo, resulting in abc.mo

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

Sidebar

Related Questions

I have code like below. If I open the file $File::Find::name (in this case
I am using find-name-dired to find multiple instances of files that all have the
Code: echo Enter the file name read fname find / -name `$fname` -print Issue:
This command and output: % find . -name file.xml 2> /dev/null ./a/d/file.xml % So
I am using File::Find in the code below to find the files from /home/user/data
I used this command to find mp3 files and write their name on log.txt:
I want to archive all txt files with File::Find, delete the source files and
I found a nice Find Name code snippet that I'm using in a WPF
I'm using jquery.fileupload.js and jquery 1.7.2. <input class=file_upload_start type=file name=files[] original-title= multiple=multiple> My file.js:
This command renames a file: $ find $PWD -name *.jpg | awk '{c=$0; gsub(/,

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.