Thread Konsolenbefehl zusammensetzen? (13 answers)
Opened by introdev at 2019-07-26 15:29

introdev
 2019-07-29 12:08
#190294 #190294
User since
2018-11-20
29 Artikel
BenutzerIn
[default_avatar]
Danke, aber Dein Programm gibt Fehler aus:


Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl

use warnings;
use strict;

my $fh;
# Reading one line from "test.json":
open($fh, "<", "/opt/habridge/data/habridge.config") or die;
my $JSON_DATA = <$fh>;
chomp($JSON_DATA);
close($fh);

my $WEBADDRESS;
my $ip = "5.5.5.5";

if ($JSON_DATA -ne "")
{
$WEBADDRESS="webaddress:jq.webaddress" . $JSON_DATA;
$JSON_DATA =~ s/$WEBADDRESS/webaddress\:$ip/g;
# Writing to "test.json":
open($fh, ">", "/opt/habridge/data/habridge.config") or die;
print $fh $JSON_DATA;
close($fh);
}



-> "syntax error at test.pl line 16, near "-ne"
syntax error at test.pl line 24, near "}"
Execution of test.pl aborted due to compilation errors."



...wobei ich da gerade nichts erkennen kann, was nicht stimmen sollte. Das "if" sollte auch stimmen:
https://stackoverflow.com/questions/2045644/what-i...
Freundliche GrĂ¼sse,
Jan

View full thread Konsolenbefehl zusammensetzen?