Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Syntax error: unexpected 'else' Post 303045216 by sea on Friday 13th of March 2020 06:06:04 PM
Old 03-13-2020
I'm not using CRON, I have no need for it.
Please give it a try in your other thread, we'll help you from there on.

I had used it like 5 years ago - ONCE, while I was writing a script to handle cron Smilie

From what I recall, it's not THAT hard, once you get past the time code lines....
But basicly it's simple:
Code:
<command> <time code settings>

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sh: syntax error: `...' unexpected???

Hello all, I want to create a script that polls every hour a directory for the existence of a file. The file I look for is a `token` dropped by an external process at the completion of a successful FTP process. I wrote this script `checkfile.ksh`: #!/usr/bin/ksh if ] then mailx... (5 Replies)
Discussion started by: alan
5 Replies

2. Shell Programming and Scripting

unexpected syntax error

Hi, i am getting following syntax error ...kingly advice why is it coming ?? #!/bin/bash find . -name "common.log" if ; then echo "1" fi Himnashu@home /bin $ ./a.sh ./a.sh: line 7: syntax error near unexpected token `fi' ./a.sh: line 7: `fi' (9 Replies)
Discussion started by: himvat
9 Replies

3. Shell Programming and Scripting

syntax error: `$' unexpected

Hi all, Am very new to Unix and am currently Involved in Migrating some Shell Scripts from AIX 4 to Solaris 10. While using teh for loop am getting the below error: $ echo $SHELL /usr/bin/ksh $ for file in $(ls *SEBE*) syntax error: `$' unexpected while the same works without issue on... (4 Replies)
Discussion started by: paragkhanore
4 Replies

4. Shell Programming and Scripting

ksh syntax error: `(' unexpected

So I am trying to convert my bash script into ksh, and this is what I have in the file so far: #!/bin/ksh login() { if then sendcmd BETA else sendcmd "$(xxd -c 32 -g 0 ${ZETA_ZETA} | awk '{print $2}')" fi } But when I run it: $ ./test.sh ... (1 Reply)
Discussion started by: guitarscn
1 Replies

5. Shell Programming and Scripting

Help with ksh syntax error Unexpected Fi

Issue resolved, thanks (6 Replies)
Discussion started by: dangell82
6 Replies

6. Shell Programming and Scripting

Syntax error: 'fi' unexpected

unzip file.zip if ] ; then echo "Success" else echo "Some failure." fi ; I tried many time to detect the unzip error, but it keep show the syntax error wherever how I change the syntac. Hope someone can help me fix the issue, thanks. Please use code tags next time for your code and... (5 Replies)
Discussion started by: duncanyy
5 Replies

7. Shell Programming and Scripting

Syntax error `(' unexpected

I have written this in my script but while running i am getting syntax error `(' unexpected. unload to "$BACKUP_DIR/n_fac_fid-$clliname" select * from n_fac_fid where fac_accesskey in (select fac_accesskey From n_fac_ap_fid where ap_clli="$clliname"); Any help appreciated. (3 Replies)
Discussion started by: suryanmi
3 Replies

8. UNIX for Beginners Questions & Answers

Syntax error near unexpected token

Dears, While executing the below script im getting the error at line 30. Please let me know what changes to be done to fix this. test.sh: line 30: syntax error near unexpected token `done' test.sh: line 30: ` done ' #!/bin/sh # Rev. PA1 # author: eillops # date: 26-04-2018 # #... (1 Reply)
Discussion started by: Kamesh G
1 Replies

9. Shell Programming and Scripting

Syntax error: `]' unexpected

I am getting this error Syntax error: `]' unexpected. Did I do something wrong with elif? Does ksh not like double brackets? if ]; then #echo hi source ~/.bashrc; elif ]; then #echo hi source ~/.kshrc; fi (5 Replies)
Discussion started by: cokedude
5 Replies

10. Shell Programming and Scripting

Syntax error: Unexpected '('

I've been trying to figure this issue for almost 2 hours now... I dont see/find any typos or other code mismatches.. but maybe i'm looking at the wrong places.... Here's the console output: $ LC_ALL=C $ cd prjs/SWARM/ ; time source ./rc bash: cd: prjs/SWARM/: No such file or directory... (3 Replies)
Discussion started by: sea
3 Replies
JSON_LAST_ERROR(3)							 1							JSON_LAST_ERROR(3)

json_last_error - Returns the last error occurred

SYNOPSIS
int json_last_error (void ) DESCRIPTION
Returns the last error (if any) occurred during the last JSON encoding/decoding. PARAMETERS
This function has no parameters. RETURN VALUES
Returns an integer, the value can be one of the following constants: JSON error codes +----------------------------+---------------------------------------------------+ | Constant | | | | | | | Meaning | | | | | | Availability | | | | +----------------------------+---------------------------------------------------+ | | | | JSON_ERROR_NONE | | | | | | | No error has occurred | | | | | | | | | T{ | | | | | | JSON_ERROR_DEPTH | | | | | | The maximum stack depth has been exceeded | | | | | | | | | T{ | | | | | | JSON_ERROR_STATE_MISMATCH | | | | | | Invalid or malformed JSON | | | | | | | | | T{ | | | | | | JSON_ERROR_CTRL_CHAR | | | | | | Control character error, possibly incorrectly | | | encoded | | | | | | | | | T{ | | | | | | JSON_ERROR_SYNTAX | | | | | | Syntax error | | | | | | | | | T{ | | | | | | JSON_ERROR_UTF8 | | | | | | Malformed UTF-8 characters, possibly incorrectly | | | encoded | | | | | | PHP 5.3.3 | | | | | | | | JSON_ERROR_RECURSION | | | | | | | One or more recursive references in the value to | | | be encoded | | | | | | PHP 5.5.0 | | | | | | | | JSON_ERROR_INF_OR_NAN | | | | | | | One or more NAN or INF values in the value to be | | | encoded | | | | | | PHP 5.5.0 | | | | | | | |JSON_ERROR_UNSUPPORTED_TYPE | | | | | | | A value of a type that cannot be encoded was | | | given | | | | | | PHP 5.5.0 | | | | +----------------------------+---------------------------------------------------+ EXAMPLES
Example #1 json_last_error(3) example <?php // A valid json string $json[] = '{"Organization": "PHP Documentation Team"}'; // An invalid json string which will cause an syntax // error, in this case we used ' instead of " for quotation $json[] = "{'Organization': 'PHP Documentation Team'}"; foreach ($json as $string) { echo 'Decoding: ' . $string; json_decode($string); switch (json_last_error()) { case JSON_ERROR_NONE: echo ' - No errors'; break; case JSON_ERROR_DEPTH: echo ' - Maximum stack depth exceeded'; break; case JSON_ERROR_STATE_MISMATCH: echo ' - Underflow or the modes mismatch'; break; case JSON_ERROR_CTRL_CHAR: echo ' - Unexpected control character found'; break; case JSON_ERROR_SYNTAX: echo ' - Syntax error, malformed JSON'; break; case JSON_ERROR_UTF8: echo ' - Malformed UTF-8 characters, possibly incorrectly encoded'; break; default: echo ' - Unknown error'; break; } echo PHP_EOL; } ?> The above example will output: Decoding: {"Organization": "PHP Documentation Team"} - No errors Decoding: {'Organization': 'PHP Documentation Team'} - Syntax error, malformed JSON Example #2 json_last_error(3) with json_encode(3) <?php // An invalid UTF8 sequence $text = "xB1x31"; $json = json_encode($text); $error = json_last_error(); var_dump($json, $error === JSON_ERROR_UTF8); ?> The above example will output: string(4) "null" bool(true) SEE ALSO
json_last_error_msg(3), json_decode(3), json_encode(3). PHP Documentation Group JSON_LAST_ERROR(3)
All times are GMT -4. The time now is 08:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy