How to Solve Programming Problems
Eventually, no matter what, you'll find a problem you can't easily figure out yourself. Here are some tips to help you find solutions better and faster.
Step 0: Don't pull an XY problem.
<bob> How can I echo the last three characters in a filename? <feline> If they're in a variable: echo ${foo: -3} <feline> Why 3 characters? What do you REALLY want? <feline> Do you want the extension? <bob> Yes. <feline> There's no guarantee that every filename will have a three-letter extension, <feline> so blindly grabbing three characters does not solve the problem. <feline> echo ${foo##*.}
Step 1: Read documentation
Step 2: The power of the internet, in your hands
Step 3: Ask Online
Last updated
Was this helpful?