Thread quoten (Shell Aufruf) (13 answers)
Opened by wenze at 2018-08-20 13:29

wenze
 2018-08-21 15:54
#188809 #188809
User since
2006-06-15
29 Artikel
BenutzerIn
[default_avatar]
So,

das ganze funktioniert herrlich unter Linux und AIX mit Perl 5.10.

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
#########################################################################################################
# delete OS mails
#########################################################################################################
   
sub DEL_mail {
        my $sidadm = $_[0]."adm";
        my $command = qq( su - $sidadm -c "cat /dev/null > /var/spool/mail/$sidadm" );
        system( $command ) == 0 or die "Failed <$command>: $!";
        #system ("su - $sidadm -c /" echo //'d *//' | mail -N//"");
        }


Allerdings gibt es Probleme mit Perl 5..8.8:

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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Bareword found where operator expected at /share/User/test/collector.pl line 189, near "my  $command =
(Might be a runaway multi-line // string starting on line 170)
(Do you need to predeclare my?)
Unquoted string "dev" may clash with future reserved word at /share/User/test/collector.pl line 189.
Unquoted string "null" may clash with future reserved word at /share/User/test/collector.pl line 189.
Bareword found where operator expected at /share/User/test/collector.pl line 189, near "/var/spool"
(Missing operator before pool?)
Unquoted string "pool" may clash with future reserved word at /share/User/test/collector.pl line 189.
Unquoted string "mail" may clash with future reserved word at /share/User/test/collector.pl line 189.
String found where operator expected at /share/User/test/collector.pl line 190, near "system( $command
(Might be a runaway multi-line "" string starting on line 189)
(Missing semicolon on previous line?)
Bareword found where operator expected at /share/User/test/collector.pl line 190, near "system( $comma
String found where operator expected at /share/User/test/collector.pl line 191, near "#system (""
(Might be a runaway multi-line "" string starting on line 190)
(Missing semicolon on previous line?)
Bareword found where operator expected at /share/User/test/collector.pl line 191, near "#system ("su"
(Missing operator before su?)
Unquoted string "su" may clash with future reserved word at /share/User/test/collector.pl line 191.
Warning: Use of "-c" without parentheses is ambiguous at /share/User/test/collector.pl line 191.
Unquoted string "mail" may clash with future reserved word at /share/User/test/collector.pl line 191.
Bareword found where operator expected at /share/User/test/collector.pl line 207, near "if (Switch::cas
(Might be a runaway multi-line // string starting on line 191)
(Do you need to predeclare if?)
Unquoted string "etc" may clash with future reserved word at /share/User/test/collector.pl line 207.
Unquoted string "issue" may clash with future reserved word at /share/User/test/collector.pl line 207.
Unquoted string "awk" may clash with future reserved word at /share/User/test/collector.pl line 207.
String found where operator expected at /share/User/test/collector.pl line 207, near "awk '{print \$3,
(Do you need to predeclare awk?)
String found where operator expected at /share/User/test/collector.pl line 209, near "#print ""
(Might be a runaway multi-line "" string starting on line 207)
(Missing semicolon on previous line?)
Scalar found where operator expected at /share/User/test/collector.pl line 209, near "#print "$OS_Level
(Missing operator before $OS_Level?)
Backslash found where operator expected at /share/User/test/collector.pl line 209, near "$OS_Level \"
(Missing operator before \?)
Unquoted string "n" may clash with future reserved word at /share/User/test/collector.pl line 209.
String found where operator expected at /share/User/test/collector.pl line 209, at end of line
(Missing semicolon on previous line?)
syntax error at /share/User/test/collector.pl line 189, near "my $command = qq( su - $sidadm -c "cat /
Can't find string terminator '"' anywhere before EOF at /share/User/test/collector.pl line 209.



Eine Idee?

View full thread quoten (Shell Aufruf)