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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:00:54+00:00 2026-05-23T07:00:54+00:00

Consider: #!/bin/bash echo ‘ ‘ $LINENO echo ” ‘ ‘ $LINENO The first echo

  • 0

Consider:

#!/bin/bash

echo '
' $LINENO
echo '' '
'  $LINENO

The first echo correctly prints a 4, but the second echo prints a 5 instead of 6. Am I missing something, or is this a bug? (Using bash 3.00.15)

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

    It looks like an implementation misfeature (bug) in bash.

    I used:

    #!/bin/bash -p
    echo $LINENO
    echo ' ' $LINENO '
    ' $LINENO '
    ' $LINENO
    echo '' '
    '  $LINENO
    

    which yielded:

    2
      3 
     3 
     3
    
     6
    

    Which supports the theory that the variable is evaluated before the shell considers the line to have been completed. Once the line has been completed, it updates the LINENO and proceeds.

    Bash versions tested: 3.2.48 (mac), 4.1.5 (linux)

    When I use the syntax:

    echo '
    ' $LINENO
    

    it gets the newer line number. It seems to be related to the evaluation of the empty string carried as the only argument on the line.

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

Sidebar

Related Questions

Consider the following: me@mine:~$ cat a.sh #!/bin/bash echo Lines: $LINES echo Columns: $COLUMNS me@mine:~$
Consider the following code snippet: #!/bin/bash #This program tests the if statement in bash.
Consider the following code and its output: Code #!/usr/bin/perl -w use strict; use Data::Dumper;
This is a very simple bash script I wrote: #!/bin/bash ITEM_LIST=items.txt LOG_FILE=log.log TOTAL_ITEMS=$(wc -l
Consider: cd C:\BORLAND\BCC55\BIN bcc32 hello.cpp Output: Borland C++ 5.5.1 for Win32 Copyright (c) 1993,
Consider this scenario in which an executable A.bin uses libY.so and libZ.so. A.c, Y.c
Consider the code below: #!/usr/bin/env python from PyQt4 import QtCore, QtGui import os,sys class
Consider: #!/usr/bin/perl use strict; use warnings; my %hash; foreach (1 .. 10) { $hash{$_}
Consider the following in .NET 3.5 (using the Bin\Net35\Facebook*.dll assemblies): using Facebook; var app
Consider that we are given an isometric grid (consider something like Diablo) of tiles.

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.