-
-
Save brentk/ed8600145302cdecc8b0e6d7c8d13190 to your computer and use it in GitHub Desktop.
Bash script to simplify opening a vs solution from a bash prompt
This file contains hidden or 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
| #!/bin/bash | |
| # Bash script to simplify opening a vs solution from a bash prompt | |
| file="" | |
| fileCount=$(ls *.sln 2> /dev/null | wc -l) | |
| if [ $fileCount -eq "0" ]; then | |
| echo "ERROR: No solution files found." | |
| exit 1 | |
| fi | |
| if [ $fileCount -ne "1" ]; then | |
| echo "More than one solution file found, please choose which one to open:" | |
| declare -i i=0 | |
| for n in *.sln; do | |
| i=$((i+1)) | |
| printf ' #%d %s\n' "$i" "$n"; | |
| done | |
| printf "\n" | |
| read -p 'Enter file #: ' filenum | |
| i=0 | |
| for n in *.sln; do | |
| i=$((i+1)) | |
| if [ $i -eq $filenum ]; then | |
| file=$n; | |
| fi | |
| done | |
| if [ "$file" == "" ]; then | |
| echo "Unknown file number $filenum" | |
| exit 1 | |
| fi | |
| else | |
| file=$(ls *.sln) | |
| fi | |
| if [ -f "$file" ]; then | |
| echo "Opening $file..." | |
| start $file | |
| else | |
| echo "Solution file $file not found?" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment