Minor improvments on eachf and show_ip
This commit is contained in:
parent
26919d0d5a
commit
368956107b
20
eachf
20
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:
|
||||
|
||||
if sys.argv[-1] in ["test", "-t", "--test"]:
|
||||
for command in commands:
|
||||
print(command)
|
||||
else:
|
||||
for command in commands:
|
||||
os.system(command)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user