Sponsored Content
Top Forums Shell Programming and Scripting Using echo to print arguments inside a function Post 302881967 by kristinu on Friday 3rd of January 2014 09:26:09 AM
Old 01-03-2014
That is correct, the -e is treated as an option. I found it strange that echo is interpreting it as I put $@ in double quotes.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Make new arguments for echo command

Hi everybody, i want to make an argument at echo command that takes a alpharithmetic and returns it reversed. How this can be done? plus what makefile changes are needed (0 Replies)
Discussion started by: Panteras
0 Replies

2. UNIX for Dummies Questions & Answers

How to correctly use an echo inside an echo?

Bit of a weird one i suppose, i want to use an echo inside an echo... For example... i have a script that i want to use to take users input and create another script. Inside this script it creates it also needs to use echos... echo "echo "hello"" >$file echo "echo "goodbye"" >$file ... (3 Replies)
Discussion started by: mokachoka
3 Replies

3. Shell Programming and Scripting

cat arguments to a function

Hi, I've a logging function in bourne shell, flog() which logs the first argument passed to it. How can I pass arguments to this function from a file, like cat filename | sed '...filtering...' | flog or cat filename | sed '...filtering...' | xargs flog Which did not work, after which... (3 Replies)
Discussion started by: Random_Net
3 Replies

4. Shell Programming and Scripting

passing arguments to unix command or script inside tclsh

hi everobody kindly consider the following in tclsh I understand that we can do the following %exec UnixCmd arg1 arg2 but if I assinged the arguments to a list insde tclsh how can I use them back i.e %set ArgList %exec UnixCmd %exec Unixcmd $list %exec all the... (1 Reply)
Discussion started by: Blue_shadow
1 Replies

5. Shell Programming and Scripting

perform echo and awk inside a string

hi, just wanted to make a shortcut of this one a="a b c" b=`echo $a | awk '{print $2}'` echo "the middle is $b" why can't i do this: a="a b c" echo "the middle is ${`echo $a | awk '{print $2}'`}" <- bad substitution :wall: thanks (6 Replies)
Discussion started by: h0ujun
6 Replies

6. Shell Programming and Scripting

Unable to echo single quotes inside awk

# echo 'export HISTFILE=/var/log/history/history_$(uname -n)_$(date +%Y:%b:%d:%H:%M)_$(who am i | awk '{print \$1}')' >> new_file # # cat new_file export HISTFILE=/var/log/history/history_$(uname -n)_$(date +%Y:%b:%d:%H:%M)_$(who am i | awk {print $1}) # Now how to echo the quotes around the... (2 Replies)
Discussion started by: proactiveaditya
2 Replies

7. Shell Programming and Scripting

Need to call a function with arguments

I need to call a function within a code with $database and $ service as the arguments How do I proceed ? and how would a function be defined and these two arguments would be used inside the function? calc_pref_avail $database $service Best regards, Vishal (7 Replies)
Discussion started by: Vishal_dba
7 Replies

8. UNIX for Beginners Questions & Answers

How to avoid arguments inside Nawk command?

Hi, Here is my command print $2 was meant to select the second column however, it is getting substituted with the second argument that was passed to the script. Can you please tell me how can I resolve this ? (6 Replies)
Discussion started by: mohtashims
6 Replies

9. Shell Programming and Scripting

Need help on awk for printing the function name inside each function

Hi, I am having script which contains many functions. Need to print each function name at the starting of the function. Like below, functionname() { echo "functionname" commands.... } I've tried like below, func=`grep "()" scriptname | cut -d "(" -f1` for i in $func do nawk -v... (4 Replies)
Discussion started by: Sumanthsv
4 Replies

10. Shell Programming and Scripting

Call same function using 2 different arguments

I have a script that uses 2 arguments. I want to call the function part within this script using these same arguments. Below is what I came up with below script so far, any guidance would be helpful. Thank you! cat backup.sh #!/bin/bash function usage { echo "USAGE: $(basename $0)... (6 Replies)
Discussion started by: mbak
6 Replies
DATEFMT_SET_LENIENT(3)							 1						    DATEFMT_SET_LENIENT(3)

IntlDateFormatter::setLenient - Set the leniency of the parser

	Object oriented style

SYNOPSIS
public bool IntlDateFormatter::setLenient (bool $lenient) DESCRIPTION
Procedural style bool datefmt_set_lenient (IntlDateFormatter $fmt, bool $lenient) Define if the parser is strict or lenient in interpreting inputs that do not match the pattern exactly. Enabling lenient parsing allows the parser to accept otherwise flawed date or time patterns, parsing as much as possible to obtain a value. Extra space, unrecognized tokens, or invalid values ("February 30th") are not accepted. PARAMETERS
o $fmt - The formatter resource o $lenient - Sets whether the parser is lenient or not, default is TRUE (lenient). RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 datefmt_set_lenient(3) example <?php $fmt = datefmt_create( 'en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/Los_Angeles', IntlDateFormatter::GREGORIAN, 'dd/MM/yyyy' ); echo 'lenient of the formatter is : '; if ($fmt->isLenient()) { echo 'TRUE'; } else { echo 'FALSE'; } datefmt_parse($fmt, '35/13/1971'); echo " Trying to do parse('35/13/1971'). Result is : " . datefmt_parse($fmt, '35/13/1971'); if (intl_get_error_code() != 0) { echo " Error_msg is : " . intl_get_error_message(); echo " Error_code is : " . intl_get_error_code(); } datefmt_set_lenient($fmt, false); echo " Now lenient of the formatter is : "; if ($fmt->isLenient()) { echo 'TRUE'; } else { echo 'FALSE'; } datefmt_parse($fmt, '35/13/1971'); echo " Trying to do parse('35/13/1971'). Result is : " . datefmt_parse($fmt, '35/13/1971'); if (intl_get_error_code() != 0) { echo " Error_msg is : ".intl_get_error_message(); echo " Error_code is : ".intl_get_error_code(); } ?> Example #2 OO example <?php $fmt = new IntlDateFormatter( 'en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/Los_Angeles', IntlDateFormatter::GREGORIAN, 'dd/MM/yyyy' ); echo 'lenient of the formatter is : '; if ($fmt->isLenient()) { echo 'TRUE'; } else { echo 'FALSE'; } $fmt->parse('35/13/1971'); echo " Trying to do parse('35/13/1971'). Result is : " . $fmt->parse('35/13/1971'); if (intl_get_error_code() != 0) { echo " Error_msg is : " . intl_get_error_message(); echo " Error_code is : " . intl_get_error_code(); } $fmt->setLenient(FALSE); echo " Now lenient of the formatter is : "; if ($fmt->isLenient()) { echo 'TRUE'; } else { echo 'FALSE'; } $fmt->parse('35/13/1971'); echo " Trying to do parse('35/13/1971'). Result is : " . $fmt->parse('35/13/1971'); if (intl_get_error_code() != 0) { echo " Error_msg is : " . intl_get_error_message(); echo " Error_code is : " . intl_get_error_code(); } ?> The above example will output: lenient of the formatter is : TRUE Trying to do parse('35/13/1971'). Result is : 66038400 Now lenient of the formatter is : FALSE Trying to do parse('35/13/1971'). Result is : Error_msg is : Date parsing failed: U_PARSE_ERROR Error_code is : 9 SEE ALSO
datefmt_is_lenient(3), datefmt_create(3). PHP Documentation Group DATEFMT_SET_LENIENT(3)
All times are GMT -4. The time now is 11:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy