![]() ![]() ![]() If you clean out any one of them, the remaining ones will take a larger percentage, and be easier to spot, on subsequent passes. You may have multiple performance problems of different sizes. If you do have a guess as to what the problem is, this will prove or disprove it. So, that is roughly the percentage of samples on which you will see it. If there is some code that is wasting some percentage of the time, 20% or 50% or whatever, that is the probability that you will catch it in the act on each sample. ![]() Just halt it several times, and each time look at the call stack. However, if you're in a hurry and you can manually interrupt your program under the debugger while it's being subjectively slow, there's a simple way to find performance problems. If your goal is to use a profiler, use one of the suggested ones. Obviously other communication strings remain untranslated here (Install, Answer) which would need to be addressed in a more fully completed translation, but even a partial translation would be helpful in many cases.įinally, please check out the excellent answer by F. Adapting my first example to better serve multiple languages might look like this: set - $(locale LC_MESSAGES) It also loops automatically, so there's no need for a while true loop to retry if they give invalid input.Īlso, Léa Gris demonstrated a way to make the request language agnostic in her answer. With select you don't need to sanitize the input – it displays the available choices, and you type a number corresponding to your choice. Here is the same example using select: echo "Do you wish to install this program?" Read -p "Do you wish to install this program?" ynĪnother method, pointed out by Steven Huwig, is Bash's select command. The best way to illustrate its use is a simple demonstration: while true do The simplest and most widely available method to get user input at a shell prompt is the read command. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |