Converting bash shell to perl


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Converting bash shell to perl
# 1  
Old 05-28-2008
Converting bash shell to perl

Does anyone know how to convert this bash shell script to perl?
Code:
for i in `ls -l *pgp`
do
`usr/bin/gpg --passphrase-fd 0 $i < .sunspot`
done

Thanks! Any help would be appreciated. I'm new to Linux and perl.

Last edited by Yogesh Sawant; 05-28-2008 at 12:11 PM.. Reason: added code tags
# 2  
Old 05-28-2008
try this:
Code:
$some_dir = "/path/to/dir";
opendir(PGP_DIR, $some_dir) || die "can't opendir $some_dir: $!";
@pgp_files = grep { /pgp$/ && -f "$some_dir/$_" } readdir(PGP_DIR);
closedir(PGP_DIR);

for my $pgp_file (@pgp_files) {
    my @output = `usr/bin/gpg --passphrase-fd 0 $pgp_file < .sunspot`;
}

# 3  
Old 05-28-2008
Thank you very much

Thank you so much Mr. Sawant!
# 4  
Old 05-28-2008
Another bash shell to perl conversion

Hello everyone. I am new to linux and need help again. I need help converting this bash shell to linux:

for i in `ls -l *.txt`
do
`./cnvidtf.pl $i`
`curl -u loginSmilieswd --disable-espv -T loadfile.seq ftp://11.1.11.1`
`mysql -u login -h 11.1.11.1 -ppswd < lddocs.sql`
done

Thanks! Any help would be greatly appreciated.

Last edited by freak; 05-28-2008 at 08:20 PM.. Reason: Smiley face in middle of code
# 5  
Old 05-29-2008
Quote:
Originally Posted by freak
Hello everyone. I am new to linux and need help again. I need help converting this bash shell to linux:

for i in `ls -l *.txt`
do
`./cnvidtf.pl $i`
`curl -u loginSmilieswd --disable-espv -T loadfile.seq ftp://11.1.11.1`
`mysql -u login -h 11.1.11.1 -ppswd < lddocs.sql`
done

Thanks! Any help would be greatly appreciated.
please ask new question in a new thread

Edit: i see that you have started a new thread here. closing this thread

Last edited by Yogesh Sawant; 05-29-2008 at 01:54 AM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting shell to Perl I run into shell built in function trap and need alternative in Perl

I am working on converting shell to Perl script. In shell we have built in function trap Do you know alternative in Perl or actually we don't need it? Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies

2. Shell Programming and Scripting

Converting macro to bash script

Gents, Please can you help me with this. When column 49 == 2 Before X 4714 14710 69445.00 19257.001 1218 12271 69596.00 19460.00 19478.001 X 4714 14710 69445.00 19257.001 1228 12292 69596.00 19480.00 19480.001 After X 4714 14710 69445.00 19257.001 1218... (1 Reply)
Discussion started by: jiam912
1 Replies

3. Shell Programming and Scripting

Please help me with converting the below bash script in C shell script

#!/bin/sh # $Header: hot_database_backup.sh,v 1.2 2002/08/06 23:51:42 $ # #bcpyrght #*************************************************************************** #* $VRTScprght: Copyright 1993 - 2007 Symantec Corporation, All Rights Reserved $ *... (2 Replies)
Discussion started by: apade
2 Replies

4. Shell Programming and Scripting

Converting Perl code to shell

I have a perl code that runs like Code I sub p { if ($d >= $D) {return} printf "%3s"x$d++," "; printf "%s%s\n",$_,$h{$_}?" ** ":""; if (!$h{$_}) { $h{$_}=1; map {p($_)} @{$s{$_}} } $d-- } ($Set,$Job,$Num,$D) = (@ARGV); map {shift} 0..3; (8 Replies)
Discussion started by: zainravi
8 Replies

5. Shell Programming and Scripting

Converting timestamps to UTC in bash

Hello, I am trying to figure out a way to convert the timestamps in a dataset from one timezone (which has daylight savings) to UTC. 2009-02-25 23:57:22,000D60727B89,221.16.86.23,SYSTEM1What would be the best way to approach this? (3 Replies)
Discussion started by: hazno
3 Replies

6. Shell Programming and Scripting

how to converting rows to columns, bash

I have in file these words: @fraza1 = rw @fraza2 = r @fraza3 = r @fraza4 = r @fraza5 = r @fraza1 = r @fraza6 = r @fraza7 = r @fraza2 = r @fraza8 = r @fraza9 = r ... I would like so that: ,rw,@fraza1 ,r,@fraza2 (2 Replies)
Discussion started by: patrykxes
2 Replies

7. Shell Programming and Scripting

Perl cmds doesn't work in Bash shell . Plz help

Hi everyone, I have a Linux OS in my PC (older version 9). Its default shell is bash. Whenever I try to run some Perl program it throws error ! eg, if I run this simple PERL program , #!/usr/bin/perl printf "\lHello \n"; $var=3 ; printf $var; @list=(1,2,3); printf "@list";... (6 Replies)
Discussion started by: adc22
6 Replies

8. Shell Programming and Scripting

Help! Need to convert bash shell to perl

Hello All. I am very new to Linux and I am currently interning. I have been working on a project for 2 weeks now and I have had no success. I have to convert bash shell into perl to decrypt and store files. Here is the code in Linux and Bash. Any help would be greatly appreciated. $... (0 Replies)
Discussion started by: freak
0 Replies

9. UNIX for Dummies Questions & Answers

Another bash shell to perl conversion

Hello everyone. I am new to linux and need help again. I need help converting this bash shell to linux: for i in `ls -l *.txt` do `./cnvidtf.pl $i` `curl -u login:pswd --disable-espv -T loadfile.seq ftp://11.1.11.1` `mysql -u login -h 11.1.11.1 -ppswd < lddocs.sql` done Thanks! Any help... (6 Replies)
Discussion started by: freak
6 Replies

10. Shell Programming and Scripting

Converting bash script to csh

Hi, I'm a beginner in scripting and I recently wrote a bash script that would've worked fine until I realized it needed to be written in csh. Could someone please show me how to correctly change the syntax from bash to csh in this script? Any help will be greatly appreciated. I can provide more... (4 Replies)
Discussion started by: Kweekwom
4 Replies
Login or Register to Ask a Question