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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:36:21+00:00 2026-05-28T07:36:21+00:00

This is my bash script: #!/usr/local/bin/bash -x touch /usr/local/p touch /usr/local/rec DATA_FULL=`date +%Y.%m.%d.%H` CHECK=`netstat

  • 0

This is my bash script:

#!/usr/local/bin/bash -x

touch /usr/local/p
touch /usr/local/rec
DATA_FULL=`date +%Y.%m.%d.%H`
CHECK=`netstat -an | grep ESTAB | egrep '(13001|13002|13003|13004|13061|13099|16001|16002|16003|16004|16061|16099|18001|18002|18003|18004|18061|18099|20001|20002|20003|20004|20061|20099|13000|16000|18000|20000)' | awk '{ print $5 }' | sort -u | wc -l`
netstat -an | grep ESTAB | egrep '(13001|13002|13003|13004|13061|13099|16001|16002|16003|16004|16061|16099|18001|18002|18003|18004|18061|18099|20001|20002|20003|20004|20061|20099|13000|16000|18000|20000)' | awk '{ print $5 }' | sort -u | wc -l > /usr/local/www/p

STAT=`cat /usr/local/www/rec`
if [ "$CHECK" -gt "$STAT" ]; then
echo $CHECK"\n"$DATA_FULL > /usr/local/p
fi

Ofcourse I’ve runned chmod +x script.sh and then sh script.sh, then I receive the following message: [: : bad number.

Why does it happends?

  • 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-28T07:36:22+00:00Added an answer on May 28, 2026 at 7:36 am

    If these are integer for sure, use this syntax,

    if [ "0$(echo $CHECK|tr -d ' ')" -gt "0$(echo $STAT|tr -d ' ')" ];
    

    A simple hack. Only works if $STAT is always either empty or positive number.

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

Sidebar

Related Questions

I have a bash script mysql_cron.sh that runs mysqldump #!/bin/bash /usr/local/mysql/bin/mysqldump -ujoe -ppassword >
This is a very simple bash script I wrote: #!/bin/bash ITEM_LIST=items.txt LOG_FILE=log.log TOTAL_ITEMS=$(wc -l
I have a bash-script (let's call it /usr/bin/bosh ) using the following she-bang line:
In a bash script that is called with sudo i am calling: /usr/bin/firefox -new-tab
I've got a ruby script myscript.sh like this #!/usr/bin/env ruby puts 'do some ruby
#/usr/bin/env bash current_time_seconds = $(date +%s) for VARIABLE in 1 2 3 4 5
I'm making a bash script which should create an ftp user. ftpasswd --passwd --file=/usr/local/etc/ftpd/passwd
Cron installation is vixie-cron /etc/cron.daily/rmspam.cron #!/bin/bash /usr/bin/rm /home/user/Maildir/.SPAM/cur/*; I Have this simple bash script
Can anyone tell me why this bash script works if I cut and paste
Let's imagine I have a bash script, where I call this: bash -c some_command

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.