-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
# butler managing command | ||
|
||
file=upload_destination.txt | ||
directories=("HTML5" "Linux" "Windows" "MacOS") | ||
channels=("html5" "linux" "win" "osx") | ||
|
||
# Check if the file exists | ||
if [ ! -e $file ]; then | ||
# File doesn't exist, create an empty one | ||
touch $file | ||
fi | ||
|
||
# File exists, read the first line into a variable | ||
read -r destination < $file | ||
|
||
if [ -z "$destination" ]; then | ||
# File is empty, prompt the user for input | ||
echo "Please enter the build destination (username/project-url-after-slash)." | ||
read -r user_input | ||
|
||
# Save user input to the file | ||
echo "$user_input" > "$file" | ||
echo "Destination saved to $file." | ||
destination="$user_input" | ||
fi | ||
|
||
# Check for the existence of directories and print mapped strings | ||
for ((i=0; i<${#directories[@]}; i++)); do | ||
dir="${directories[i]}" | ||
channel="${channels[i]}" | ||
|
||
if [ -d "$dir" ]; then | ||
echo butler push ./$dir/ $destination:$channel | ||
butler push ./$dir/ $destination:$channel | ||
else | ||
echo "Directory '$dir' does not exist." | ||
fi | ||
done |