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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:39:34+00:00 2026-06-10T02:39:34+00:00

Within the script, I’ve been using wc (word count) to check files after making

  • 0

Within the script, I’ve been using wc (word count) to check files after making changes to them. It works, but I was wondering if there’s a better way of checking the file. For example, If I used wc -m and accidentally put in a blank line in the script. The script will fail unless I catch it and change the expected output of wc -m.

cat <<-EOF > /etc/hosts

192.168.1.1

192.168.1.2

192.168.1.3

EOF

if [ "$(wc -m /etc/hosts" == "33 /etc/hosts" ] ; then

echo it worked

else 

echo it didnt work

fi
  • 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-10T02:39:36+00:00Added an answer on June 10, 2026 at 2:39 am

    There is not going to be any universally good verification. Your checks will be specific to what you think the file should look like and how you think the file should have changed. One thing I would suggest is to back up the file before you change it so that you can do relative checks instead of absolute checks.

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

Sidebar

Related Questions

I am using php to create url shorten website. Within that script I am
I've been trying the below script (within a larger app I'm working on) for
I want to execute a Python CGI Script within a .shtml file, but I
I'm using constants to set various configuration variables within a script. The INC_PATH constant
I am calling an external program within Python script using subprocess. The external program
Ok, I am allowing (within a script) for certain types of files to be
This script is run from within a directory of OGG files. cd c:\dirWithOGG for
I am trying to write a shell script to check database connectivity. Within my
When using var _gaq = _gaq || []; within a script tag what would
I'm using the following script within a Chrome extension I made. It replaces old

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.