Recently someone asked me about accepting bash inputs. So I decided to take a stab at writing a little about it up. For the initial one we’ll look at accepting text input. Here, we’ll just sandwich a read statement between two echo commands. In the first echo we’ll ask for a name of a variable. Then we’ll read it in with the read command. And in the second echo we’ll write it out. Using the variable involves using the string of the variable (myvariable in this case) with a dollar sign in front of it, as in $myvariable below: echo "Please choose a number: " read myvariable echo "You picked…
-
-
Using Inputs in Bash Scripts
You can easily accept user provided input in bash by using the read command in bash for Linux and OS X. Here, we’ll echo out a choice to a user in a script, read the output into a variable called yn and then echo out the response: echo "Please enter y or n: " read yn echo "You chose wrong: $yn" Here, we used echo to simply write out what was chosen in the input. But we could also take this a little further and leverage a case statement to then run an action based on the choice selected: read -p "Should the file extension change warning be disabled (y/n)?…
-
Spotlightish Finder
When you search for files the Finder window with the results has what is known as the Path Bar. As you can see in the below image, the Path Bar allows you to click on any directory in the hierarchy up to the one you are on and open that directory in the Finder. By default, the Path Bar is only shown in a search result, but if you like it then you can see it in every Finder window. To enable this feature, create a boolean key in the com.apple.finder.plist with a value of yes. To do so, you can use the defaults command: defaults write com.apple.finder ShowPathBar -bool…
-
Speed Up ScreenSharing
Screen Sharing over a WAN can be a bit slow. But you can send less data and receive a less latent connection. To do so, you are going to augment the controlObserveQuality key of the com.apple.ScreenSharing.plist property list. If you set the key to a 1, which I see commonly suggested then it will be black and white, which in todays world is another way of saying practically illegible. Instead try the number 2, which sets it to grey scale, which is pretty good (that’s what I use). To do so run: defaults write com.apple.ScreenSharing controlObserveQuality 2 You can also set the controlObserveQuality key to 3, 4 or 5 which…