how can i declare variable in perl.
for BLOCK in /sys/block/emcpow*
how can i declare variable in perl.
for BLOCK in /sys/block/emcpow*
That's not even how you declare a variable in shell... I think you mean, how do you *-globbing in perl.
foreach( </sys/block/emcpow*> )
{
system("blockdev --setra 16384 $_");
}
Just one thing to realize: system() runs a shell exactly like the shell the scripts I already showed you ran in.
So you are not running perl instead of shell. You're running lots and lots of shells, with a tiny topping of pointless perl. (Sorry, it's a peeve of mine.)
please check below code is it true.
foreach( </sys/block/emcpow*> )
{
system("echo "noop"", "$_");
}
---------- Post updated at 04:55 PM ---------- Previous update was at 04:53 PM ----------
Another code in perl is correct please confirm
foreach( </sys/block/emcpow*> )
{
blockdev --setra 16384 $_;
}
---------- Post updated at 05:24 PM ---------- Previous update was at 04:55 PM ----------
sir it is giving error
BLKRASET: Inappropriate ioctl for device when running below perl code.
---------- Post updated at 05:37 PM ---------- Previous update was at 05:24 PM ----------
Please correct this
system("echo "noop" > $_");
system() takes one parameter, not two or three or four.
You can't put quotes in quotes like that. If you must, escape them like \".
I repeat. By doing this "in perl", you are actually doing this in lots and lots of shells. Every time you run system(), you are running /bin/sh. There is no purpose to using perl here.