From a1b7f62196bf5c349cb342ba0d28c112ccee7768 Mon Sep 17 00:00:00 2001 From: Elex Date: Sun, 26 Feb 2023 00:01:58 +0900 Subject: [PATCH] 2023-02-26 00:01:58 --- README.md | 1 + launch | 33 +++++++++++++++++++++++++++++++++ src/glob.pl | 8 ++++++++ gui-tk.pl => src/gui-tk.pl | 0 hello.pl => src/hello.pl | 0 5 files changed, 42 insertions(+) create mode 100644 README.md create mode 100755 launch create mode 100755 src/glob.pl rename gui-tk.pl => src/gui-tk.pl (100%) rename hello.pl => src/hello.pl (100%) diff --git a/README.md b/README.md new file mode 100644 index 0000000..32cfc96 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Perl Examples diff --git a/launch b/launch new file mode 100755 index 0000000..5612965 --- /dev/null +++ b/launch @@ -0,0 +1,33 @@ +#!/usr/bin/perl + +use strict; +use lib "/media/elex/UltraFit/Scripts/my-scripts/perl/modules"; +use MyTime; + +my $doc = < + * git - add, commit, push + * mod - chmod a+x *.pl +DOC + +sub git { + my $now = &MyTime::ymdhms; + system("git add -A"); + system("git commit -m '$now'"); + system("git push -u origin"); +} + +sub chmod{ + system("chmod a+x *src/*.pl"); +} + +my $argc = $#ARGV + 1; +my $argv1 = @ARGV[0]; + +if ($argv1 eq "git"){ + &git; +} elsif ($argv1 eq "mod") { + &chmod; +} else { + print $doc; +} \ No newline at end of file diff --git a/src/glob.pl b/src/glob.pl new file mode 100755 index 0000000..2842192 --- /dev/null +++ b/src/glob.pl @@ -0,0 +1,8 @@ +#!/usr/bin/perl +use strict; + +chdir("/home/elex/") or die("$!"); +my @files = glob("*"); +for (@files){ + print "$_\n"; +} \ No newline at end of file diff --git a/gui-tk.pl b/src/gui-tk.pl similarity index 100% rename from gui-tk.pl rename to src/gui-tk.pl diff --git a/hello.pl b/src/hello.pl similarity index 100% rename from hello.pl rename to src/hello.pl