Sponsored Content
Full Discussion: $LINENO no show
Top Forums Shell Programming and Scripting $LINENO no show Post 303021605 by annacreek on Monday 13th of August 2018 09:15:30 AM
Old 08-13-2018
'$LINENO is bash "system" variable but I cannot get any output trying to use it."


OK, I did not say "I am using bash ".

Yes, being a geenie I thought
# denotes comments, apparently not.


So I moved
#!/bin/bash back as first line in file



Here is a code snippet :



Code:
czechlist_DEBUG(){
  64 echo "czechlist_DEBUG "
  65 echo "Passed parameter #1 is $1"
  66 echo "Passed parameter #2 is $2"
  67 echo "Passed parameter #3 is $3"
  68 echo "Passed parameter #4 is $4"
  69
   70 echo "arg count = $#"
initialize while "count" 

   71 while [ $# -gt 0 ]
  72 do
  73     echo "$1 on $LINENO " 

 echoes "first" parameter "found" , so the construct 

is 

      while 

      do 

     ...
     done 

??

 
 
  74     shift
  75 done
  76 echo " DONE line output "
  77
  78 pause


And here is an output , getting there:



Code:
czechlist_DEBUG 
Passed parameter #1 is DEBUG USB 
Passed parameter #2 is lsusb
Passed parameter #3 is test par 2
Passed parameter #4 is test par 3
arg count = 4
DEBUG USB  on 73 
lsusb on 73 
test par 2 on 73 
test par 3 on 73 
 DONE line output 
Press [Enter] key to continue...


Last edited by annacreek; 08-13-2018 at 10:25 AM..
 

7 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Show us your Desktop

I don't see any threads like this and I know that a bunch of people have really cool desktops, so I`ll start. rules 1 no images in your post,attachments only 2 no default desktops, tha would be very much a waste (2 Replies)
Discussion started by: Genral
2 Replies

2. UNIX for Dummies Questions & Answers

Show path name

Hello I'm new to this forum. So please spare me! I'm using SCO UnixWare 7.1.4 and created a few accounts. So far so good. When I login I see: $. But here I want to see (for example), /home 25$ So I want to see the pathname where I am without each time typing pwd (2 Replies)
Discussion started by: p.vvugt
2 Replies

3. UNIX for Dummies Questions & Answers

ls how to not show date

Hello, I'm using ls -laR to print out a list of file and folders. I want to print only the permission, file size and file name. Also, excluding the '.' and '..'. result from ls -laR: total 6 drwxr-xr-x 8 user staff 512 Nov 28 16:17 . drwxr-x--- 16 user staff 1024... (3 Replies)
Discussion started by: minifish
3 Replies

4. Shell Programming and Scripting

Display LineNo Incase Total Number Of Delimiter Does matches in a given variable

I have many files .dat extension. requirement is to display line no if no of delimiter does not matches in a given variable lets say File: REF_BETOS.dat HCPCS_OR_CPT_CODE~BETOS_CODE~TERMINATION_DATE 0001F~Z2~ 0003T~I4~B20061231 0005F~Z2~~~ 0008T~P8~B20061231... (1 Reply)
Discussion started by: ainuddin
1 Replies

5. Shell Programming and Scripting

How to show the type of my terminal?

How to show the type of my terminal? Thanks in advance! (1 Reply)
Discussion started by: Henryyy
1 Replies

6. Post Here to Contact Site Administrators and Moderators

Show all my Posts?

Hello, Is there a way to display all of the posts I have authored? Many thanks in advance. (1 Reply)
Discussion started by: dlundwall
1 Replies

7. Homework & Coursework Questions

Show help

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Display the contents of all files ending in a number to the screen 2. Relevant commands, code, scripts,... (2 Replies)
Discussion started by: marcincan
2 Replies
ROUND(3)								 1								  ROUND(3)

round - Rounds a float

SYNOPSIS
float round (float $val, [int $precision], [int $mode = PHP_ROUND_HALF_UP]) DESCRIPTION
Returns the rounded value of $val to specified $precision (number of digits after the decimal point). $precision can also be negative or zero (default). Note PHP doesn't handle strings like "12,300.2" correctly by default. See converting from strings. PARAMETERS
o $val - The value to round o $precision - The optional number of decimal digits to round to. o $mode - Use one of the following constants to specify the mode in which rounding occurs. +--------------------+---------------------------------------------------+ | Constant | | | | | | | Description | | | | +--------------------+---------------------------------------------------+ | | | | PHP_ROUND_HALF_UP | | | | | | | Round $val up to $precision decimal places away | | | from zero, when it is half way there. Making 1.5 | | | into 2 and -1.5 into -2. | | | | | | | |PHP_ROUND_HALF_DOWN | | | | | | | Round $val down to $precision decimal places | | | towards zero, when it is half way there. Making | | | 1.5 into 1 and -1.5 into -1. | | | | | | | |PHP_ROUND_HALF_EVEN | | | | | | | Round $val to $precision decimal places towards | | | the next even value. | | | | | | | |PHP_ROUND_HALF_ODD | | | | | | | Round $val to $precision decimal places towards | | | the next odd value. | | | | +--------------------+---------------------------------------------------+ RETURN VALUES
The rounded value EXAMPLES
Example #1 round(3) examples <?php echo round(3.4); // 3 echo round(3.5); // 4 echo round(3.6); // 4 echo round(3.6, 0); // 4 echo round(1.95583, 2); // 1.96 echo round(1241757, -3); // 1242000 echo round(5.045, 2); // 5.05 echo round(5.055, 2); // 5.06 ?> Example #2 $mode examples <?php echo round(9.5, 0, PHP_ROUND_HALF_UP); // 10 echo round(9.5, 0, PHP_ROUND_HALF_DOWN); // 9 echo round(9.5, 0, PHP_ROUND_HALF_EVEN); // 10 echo round(9.5, 0, PHP_ROUND_HALF_ODD); // 9 echo round(8.5, 0, PHP_ROUND_HALF_UP); // 9 echo round(8.5, 0, PHP_ROUND_HALF_DOWN); // 8 echo round(8.5, 0, PHP_ROUND_HALF_EVEN); // 8 echo round(8.5, 0, PHP_ROUND_HALF_ODD); // 9 ?> Example #3 $mode with precision examples <?php /* Using PHP_ROUND_HALF_UP with 1 decimal digit precision */ echo round( 1.55, 1, PHP_ROUND_HALF_UP); // 1.6 echo round( 1.54, 1, PHP_ROUND_HALF_UP); // 1.5 echo round(-1.55, 1, PHP_ROUND_HALF_UP); // -1.6 echo round(-1.54, 1, PHP_ROUND_HALF_UP); // -1.5 /* Using PHP_ROUND_HALF_DOWN with 1 decimal digit precision */ echo round( 1.55, 1, PHP_ROUND_HALF_DOWN); // 1.5 echo round( 1.54, 1, PHP_ROUND_HALF_DOWN); // 1.5 echo round(-1.55, 1, PHP_ROUND_HALF_DOWN); // -1.5 echo round(-1.54, 1, PHP_ROUND_HALF_DOWN); // -1.5 /* Using PHP_ROUND_HALF_EVEN with 1 decimal digit precision */ echo round( 1.55, 1, PHP_ROUND_HALF_EVEN); // 1.6 echo round( 1.54, 1, PHP_ROUND_HALF_EVEN); // 1.5 echo round(-1.55, 1, PHP_ROUND_HALF_EVEN); // -1.6 echo round(-1.54, 1, PHP_ROUND_HALF_EVEN); // -1.5 /* Using PHP_ROUND_HALF_ODD with 1 decimal digit precision */ echo round( 1.55, 1, PHP_ROUND_HALF_ODD); // 1.5 echo round( 1.54, 1, PHP_ROUND_HALF_ODD); // 1.5 echo round(-1.55, 1, PHP_ROUND_HALF_ODD); // -1.5 echo round(-1.54, 1, PHP_ROUND_HALF_ODD); // -1.5 ?> CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | The $mode parameter was introduced. | | | | | 5.2.7 | | | | | | | The inner workings of round(3) was changed to | | | conform to the C99 standard. | | | | +--------+---------------------------------------------------+ SEE ALSO
ceil(3), floor(3), number_format(3). PHP Documentation Group ROUND(3)
All times are GMT -4. The time now is 07:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy