error when call function in bash script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting error when call function in bash script
# 15  
Old 02-23-2010
gzip, zip, Z, ... more usable.

SunOS include usually also xpg4 version, try it.
ex. /xpg4/bin/awk
There are many commands in SunOS which works little different as ex. xpg4/posix version or gnu version.
Same situation with some other commercial *nix.
find / -name awk
and you'll see the all location where you have awk.
(or maybe nawk, gawk, ...).

Code:
#!/bin/ksh
AWK=/xpg4/bin/awk

somefunc()
{
    $AWK ....
}
#....
somefunc
# ....

# 16  
Old 02-23-2010
Just as suspected, notice the "\r":

Code:
od -c -N20 Daily_Finance.sh
0000000   #   !   /   u   s   r   /   b   i   n   /   b   a   s   h  \r
0000020  \n   #   #   #

# 17  
Old 02-23-2010
Just as suspected, notice the "\r":

Code:
od -c -N20 Daily_Finance.sh
0000000   #   !   /   u   s   r   /   b   i   n   /   b   a   s   h  \r
0000020  \n   #   #   #

# 18  
Old 02-24-2010
Dear binlib,

Could you please explain more?
# 19  
Old 02-24-2010
binlib has notice that your script appears to contain MSDOS line terminators not unix line terminators. This often happens when a script is edited on a PC in a product such as Notepad and then transferred to a unix system without proper conversion. It could equally happen when preparing a post for this forum!

Worth checking the script. To see the line terminators. This unix command makes them visible. A normal unix text line just shows as a $ sign in this program.

Code:
sed -n l script_name

# 20  
Old 02-24-2010
Dear methyl,

I checked the output of the sed command you send and I didn't find any MS-DOS caracters, also i ran the following line

tr '^M' < Daily_Finance.sh > Daily_Finance2.sh

but the same problem still exist.

Thanks,
# 21  
Old 03-03-2010
Dears,

Any suggestions?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk call in bash function called with arugments not working, something lost in translation?

Hello, I have this awk code in a bash script to perform a find and replace task. This finds one unique line in a file and substitutes the found line with a replacement. #! /bin/bash # value determined elsewhere total_outputs_p1=100 # file being modified... (5 Replies)
Discussion started by: LMHmedchem
5 Replies

2. Shell Programming and Scripting

Call function as different user within the script

Hello For HP-UX, ksh shell, is it possible to define functions and call them by another user ? For example <function_name> ( ) { command1 command2 } su - <user> -c <function_name> Or the only option is defining the user in the function itself as follows - <function_name> ( )... (2 Replies)
Discussion started by: atanubanerji
2 Replies

3. Shell Programming and Scripting

Call function from another script

Hey, i got this 2 file. When i try to pick option 1, which is test1, it says ./test: test1: not found. Any idea on how i can fix it? #!/bin/sh QUIT=0 `dirname $0`/testfile while ; do testmenu read option case $option in 1) test1 ;; 2) test2 ;; 3) echo... (2 Replies)
Discussion started by: Nick1097
2 Replies

4. Shell Programming and Scripting

Script – Function Call

Hello, I have Individual function in my shell script , Function1 { Master activities } Function2 { Sub activities 1 } Function3 { Sub activities 2 } … (2 Replies)
Discussion started by: Shanks
2 Replies

5. Shell Programming and Scripting

Shell Script to call another function

Here is the following code : 1. # gcc -c test firstprog.c the above command will generate a executable file called "test " in which ever directory it is run. Assuming It will also return a value. 2. In the below SCRIPT . test is a file generated by compiling a c program... (3 Replies)
Discussion started by: Vabiosis
3 Replies

6. Web Development

Fatal Error: Call to undefined function imagefilter()

I am using PHP5 in ubuntu 9.10. First I installed PHP and GD as separate package. I tried doing manipulation with images using php image function. When I try using the function imagefilter(), it was not worked and got the solution that need to compile the PHP with the bundled version of GD. So... (0 Replies)
Discussion started by: skg
0 Replies

7. Shell Programming and Scripting

Bash: how to call function having it's name in variable?

Hello. Looking for a method of modularizing my bash script, I am stuck with such a problem. For example, I have: MODULE_NAME="test" FUNCTION_NAME="run" How do I can a function with name test_run? (4 Replies)
Discussion started by: FractalizeR
4 Replies

8. Shell Programming and Scripting

how can i call a function in shell script

i have a function written in one shell script and i want to call that function in another shell script and use the value returned by that script. can any one suggest me how can i do that? regards, Rajesh.P (4 Replies)
Discussion started by: rajesh.P
4 Replies

9. Shell Programming and Scripting

i want to call a oracle function in my shell script

i want to call a oracle function in my shell script (4 Replies)
Discussion started by: dineshr85
4 Replies
Login or Register to Ask a Question