diff --git a/eachf b/eachf index cf0675e..3d5567c 100755 --- a/eachf +++ b/eachf @@ -3,8 +3,8 @@ import sys, os if sys.argv[1] in ["--help", "-h"]: print("\nWelcome to the cli helper for foreach loops.") - print("\nUsage:\neachf [path] [filter] [command1] [command2]") - print("\nDescription:\nIn between the two command-arguments, the filename will be inserted.\n") + print("\nUsage:\neachf [path] [filter] [command1] [command2] [command3] [test]") + print("\nDescription:\nIn between the command-arguments, the filename will be inserted.\n") exit() files = os.listdir(sys.argv[1]) @@ -17,11 +17,17 @@ for file in files: filtered_files.append(file) for f in filtered_files: - if len(sys.argv) == 4: - c = sys.argv[3] + " " + f - else: - c = sys.argv[3] + " " + f + " " + sys.argv[4] + c = sys.argv[3] + f + if len(sys.argv) >= 5: + c = c + sys.argv[4] + if len(sys.argv) >= 6: + c = c + f + sys.argv[5] commands.append(c) -for command in commands: - os.system(command) + +if sys.argv[-1] in ["test", "-t", "--test"]: + for command in commands: + print(command) +else: + for command in commands: + os.system(command) diff --git a/show_ip.sh b/show_ip.sh index d4ae688..1bdfd7d 100755 --- a/show_ip.sh +++ b/show_ip.sh @@ -1,2 +1,2 @@ -ip_value=$(curl -s https://dnsleak.com/ | grep "You are connecting from an IPv4 address" -A 2 | grep "text" | awk '{ print $3}') -echo $ip_value | sed -e 's/value="//g' | sed -e 's/"//g' +ip_value=$(curl -s https://api.ipify.org/) +echo $ip_value