Hey everyone, Today's post is about a simple little shell script that solves a problem I'm sure many of us have run into. We've all been there: you're following a tutorial online and you blindly copy a command to paste into your terminal. The example looks something like this: ```bash $ curl https://example.com ``` If you're not paying attention, you accidentally copy the `$` prompt character along with the command. When you paste it and hit enter, your shell throws an error like `$: command not found`. It's a minor but frequent annoyance. --- ### A Simple, Foolproof Solution To solve this for myself, I wrote a simple script that I named `$` and placed it in my path (`~/.local/bin`). Now, instead of an error, my shell gives me a helpful confirmation prompt. I call it the "Hey, you might have made a mistake" prompt. Here's the script: ```bash #!/usr/bin/env bash # Simple command wrapper that confirms before running pasted commands set -euo pipefail main() { local status=0 # Reconstruct the command as a safely quoted string for display local cmd_str="" for arg in "$@"; do if [ -z "$cmd_str" ]; then printf -v cmd_str "%q" "$arg" else printf -v cmd_str "%s %q" "$cmd_str" "$arg" fi done # Standard prompt and confirmation echo "It looks like you pasted a command prefixed with '$'." echo "Command:" echo " $cmd_str" echo read -r -p "Do you want to run this command? [y/N] " reply case "$reply" in [yY] | [yY][eE][sS]) ;; *) echo "Canceled." return 0 ;; esac # Execute the actual command "$@" || status=$? if [ $status -eq 0 ]; then echo "Command completed successfully." else echo "Command failed with exit code $status." fi return $status } main "$@" ``` Now, when I accidentally paste a command with a leading dollar sign, I get this instead of an error:  The script simply takes all the arguments passed to it (which is the command you intended to run), asks if you want to execute it, and then runs it if you confirm. It's a tiny quality-of-life improvement that turns a common mistake into a helpful interaction. As always, Michael Garcia a.k.a. TheCrazyGM
author | thecrazygm | ||||||
---|---|---|---|---|---|---|---|
permlink | turning-a-common-terminal-mistake-into-a-feature | ||||||
category | hive-186392 | ||||||
json_metadata | {"app":"peakd/2025.8.3","format":"markdown","tags":["dev","bash","archon","tribes","pimp","proofofbrain"],"users":[],"image":["https://files.peakd.com/file/peakd-hive/thecrazygm/Eo1wU86Pj3LfawJprhJwB8jbMjZNdbSW16EjjYjE9qDgQfW4kMD4hZRGrrpLzLBtwVG.png"]} | ||||||
created | 2025-08-13 11:18:42 | ||||||
last_update | 2025-08-13 11:18:42 | ||||||
depth | 0 | ||||||
children | 5 | ||||||
last_payout | 2025-08-20 11:18:42 | ||||||
cashout_time | 1969-12-31 23:59:59 | ||||||
total_payout_value | 3.400 HBD | ||||||
curator_payout_value | 3.981 HBD | ||||||
pending_payout_value | 0.000 HBD | ||||||
promoted | 0.000 HBD | ||||||
body_length | 2,374 | ||||||
author_reputation | 122,979,132,462,946 | ||||||
root_title | "Turning a Common Terminal Mistake into a Feature" | ||||||
beneficiaries |
| ||||||
max_accepted_payout | 1,000,000.000 HBD | ||||||
percent_hbd | 10,000 | ||||||
post_id | 144,954,270 | ||||||
net_rshares | 27,376,957,952,194 | ||||||
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
jacor | 0 | 26,660,651,522 | 50% | ||
eforucom | 0 | 23,735,004,224 | 100% | ||
dylanhobalart | 0 | 83,460,976,998 | 11% | ||
moretea | 0 | 3,237,441,006 | 10% | ||
gamer00 | 0 | 19,131,770,454 | 5% | ||
funnel | 0 | 2,766,730,519 | 4% | ||
ganjafarmer | 0 | 1,954,332,235 | 1% | ||
freebornsociety | 0 | 24,743,327,593 | 42% | ||
mes | 0 | 327,626,638,624 | 25% | ||
calmphoenix | 0 | 1,468,829,698 | 30% | ||
ecoinstant | 0 | 16,833,208,253 | 100% | ||
cryptoknight12 | 0 | 54,118,827,567 | 100% | ||
joeyarnoldvn | 0 | 448,999,207 | 1.47% | ||
grocko | 0 | 1,916,765,853 | 2% | ||
eturnerx | 0 | 25,581,076,738 | 1.9% | ||
bambukah | 0 | 645,606,976 | 0.8% | ||
pixelfan | 0 | 53,586,540,567 | 5.7% | ||
likedeeler | 0 | 253,802,438,498 | 100% | ||
hdmed | 0 | 5,368,350,525 | 50% | ||
noloafing | 0 | 3,036,094,884 | 49.76% | ||
niallon11 | 0 | 1,362,244,405,651 | 100% | ||
accelerator | 0 | 21,324,596,489 | 60% | ||
fatman | 0 | 9,288,116,226 | 2% | ||
votehero | 0 | 26,695,927,344 | 5.2% | ||
msp-makeaminnow | 0 | 27,031,701,291 | 28.4% | ||
investegg | 0 | 194,523,987,052 | 100% | ||
morwhale | 0 | 831,015,540 | 50% | ||
morwhaleplus | 0 | 590,000,091 | 50% | ||
dbooster | 0 | 1,210,445,892,006 | 100% | ||
coolguy123 | 0 | 2,801,713,113 | 1% | ||
morwhalebonus | 0 | 585,738,802 | 50% | ||
mytechtrail | 0 | 19,229,425,605 | 15% | ||
jozefkrichards | 0 | 5,153,435,832 | 50% | ||
kernelillo | 0 | 1,524,475,978 | 50% | ||
sneakyninja | 0 | 17,365,524,389 | 24.88% | ||
najat | 0 | 3,096,241,663 | 50% | ||
steembasicincome | 0 | 4,455,435,891,796 | 100% | ||
crookshanks | 0 | 1,207,592,005 | 100% | ||
deepresearch | 0 | 1,233,376,229,210 | 31% | ||
hetty-rowan | 0 | 44,985,885,196 | 50% | ||
irisworld | 0 | 1,389,237,869 | 7.5% | ||
bengy | 0 | 2,872,020,818 | 3% | ||
aakom | 0 | 448,607,482 | 100% | ||
fireguardian | 0 | 575,603,540 | 20% | ||
anikys3reasure | 0 | 2,142,517,141 | 50% | ||
antisocialist | 0 | 286,423,298,611 | 33% | ||
abrockman | 0 | 3,440,483,914,400 | 100% | ||
ravenmus1c | 0 | 3,876,225,586 | 0.2% | ||
adamada | 0 | 1,954,241,434 | 2% | ||
sbi2 | 0 | 2,887,942,340,504 | 100% | ||
awesomegames007 | 0 | 1,288,235,306 | 50% | ||
sbi3 | 0 | 1,429,083,321,855 | 100% | ||
sbi4 | 0 | 1,068,615,082,210 | 100% | ||
fw206 | 0 | 2,503,090,108,924 | 29% | ||
netzisde | 0 | 3,631,822,753 | 100% | ||
dailyspam | 0 | 24,316,848,891 | 20% | ||
sgbonus | 0 | 11,394,237,614 | 16% | ||
bububoomt | 0 | 5,703,839,606 | 100% | ||
sbi5 | 0 | 747,742,880,717 | 100% | ||
sbi6 | 0 | 564,091,131,090 | 100% | ||
steemulant | 0 | 98,438,505 | 6.63% | ||
thedailysneak | 0 | 23,716,904,156 | 24.88% | ||
smartvote | 0 | 74,902,094,076 | 3.6% | ||
sbi7 | 0 | 424,269,558,253 | 100% | ||
tdas0 | 0 | 2,105,305,211 | 50% | ||
voxmortis | 0 | 11,182,127,512 | 6% | ||
pboulet | 0 | 227,421,278,037 | 100% | ||
a-bot | 0 | 14,518,451,575 | 30% | ||
voter001 | 0 | 26,682,091,748 | 24.9% | ||
voter007 | 0 | 161,600,792 | 100% | ||
ravensavage | 0 | 4,899,305,854 | 49.76% | ||
mk992039 | 0 | 656,192,362 | 4% | ||
guurry123 | 0 | 7,224,106,151 | 10% | ||
ecoinstats | 0 | 238,129,088,599 | 100% | ||
pocketjs | 0 | 95,099,431 | 6.63% | ||
sbi8 | 0 | 311,108,967,620 | 100% | ||
piestrikesback | 0 | 662,285,261 | 100% | ||
sbi9 | 0 | 227,291,183,478 | 100% | ||
buildingpies | 0 | 52,938,876,999 | 100% | ||
sbi10 | 0 | 171,568,316,276 | 100% | ||
slothlydoesit | 0 | 19,333,517,334 | 10% | ||
thelogicaldude | 0 | 25,005,566,913 | 50% | ||
filosof103 | 0 | 85,574,349,731 | 50% | ||
bigmoneyman | 0 | 527,387,638 | 30% | ||
shauner | 0 | 467,890,352 | 50% | ||
gurseerat | 0 | 5,374,294,582 | 20% | ||
lrekt01 | 0 | 6,897,902,024 | 80% | ||
everythingsmgirl | 0 | 7,942,584,850 | 50% | ||
lisamgentile1961 | 0 | 5,436,998,802 | 3% | ||
sbi-tokens | 0 | 42,345,598,656 | 49.76% | ||
urun | 0 | 23,351,538,486 | 100% | ||
maxuve | 0 | 0 | 100% | ||
qwertm | 0 | 4,044,807,960 | 50% | ||
manclar | 0 | 8,037,392,784 | 50% | ||
neoxvoter | 0 | 2,920,434,791 | 24% | ||
treasure.hoard | 0 | 477,720,963,042 | 100% | ||
dpend.active | 0 | 3,822,422,857 | 10% | ||
hivetrending | 0 | 10,098,614,856 | 3% | ||
ykretz | 0 | 1,446,466,910 | 15% | ||
imfarhad | 0 | 24,997,645,646 | 20% | ||
sketching | 0 | 7,086,163,089 | 50% | ||
hivelist | 0 | 2,014,584,985 | 2% | ||
woelfchen | 0 | 122,013,886,456 | 29% | ||
archon-gov | 0 | 108,818,191,180 | 50% | ||
rudy-dj | 0 | 2,738,444,729 | 30% | ||
captaincryptic | 0 | 31,860,470,742 | 20% | ||
barbyjr | 0 | 1,900,083,193 | 25% | ||
chaos23 | 0 | 2,526,708,539 | 25% | ||
yayogerardo | 0 | 507,032,879 | 33% | ||
dadspardan | 0 | 1,479,826,213 | 2% | ||
youloseagain | 0 | 523,216,537 | 5% | ||
szukamnemo | 0 | 49,540,196,312 | 15.5% | ||
esmeesmith | 0 | 1,778,457,164 | 50% | ||
tikki00taffi | 0 | 1,407,064,862 | 75% | ||
huzzah | 0 | 1,165,192,052 | 4% | ||
emsenn0 | 0 | 4,067,863,957 | 20% | ||
cooperclub | 0 | 771,961,732 | 2% | ||
hive.pizza | 0 | 162,274,797,234 | 4% | ||
pizzabot | 0 | 451,997,668 | 100% | ||
alkirua | 0 | 34,621,514,324 | 100% | ||
rayius | 0 | 448,706,590 | 100% | ||
pishio | 0 | 192,955,094,037 | 5% | ||
noempathy | 0 | 9,362,421,856 | 100% | ||
elephantium | 0 | 1,270,986,685 | 50% | ||
adulruna | 0 | 26,262,102,585 | 100% | ||
vrezyy | 0 | 9,032,253,357 | 25% | ||
tub3r0 | 0 | 764,787,398 | 10% | ||
mxm0unite | 0 | 1,631,684,807 | 50% | ||
dstampede | 0 | 1,345,809,784 | 100% | ||
techguard | 0 | 999,011,269 | 15.5% | ||
tydynrain | 0 | 16,591,744,145 | 10% | ||
chaosmagic23 | 0 | 22,235,116,166 | 50% | ||
dkidfit | 0 | 7,191,515,050 | 100% | ||
bluedevil0722 | 0 | 567,688,711 | 50% | ||
svanbo | 0 | 1,771,696,363 | 1% | ||
lothbrox | 0 | 867,470,610 | 100% | ||
rulivyxo | 0 | 555,514,474 | 30% | ||
zerofucks | 0 | 4,643,047,768 | 100% | ||
studio3141 | 0 | 449,688,224 | 50% | ||
chrisly.social | 0 | 81,349,681,423 | 50% | ||
ryosai | 0 | 6,114,310,591 | 24% | ||
fernandoylet | 0 | 42,467,333,172 | 33% | ||
prosocialise | 0 | 9,871,987,986 | 2% | ||
beststart | 0 | 15,268,220,470 | 5% | ||
fonestreet | 0 | 1,479,370,073 | 25% | ||
holdeck2 | 0 | 1,663,384,825 | 100% | ||
vrezion | 0 | 568,208,477 | 100% | ||
casimodo | 0 | 928,032,685 | 100% | ||
dutchchemist | 0 | 452,766,641 | 100% | ||
poplar-22 | 0 | 3,556,691,310 | 25% | ||
thoth442 | 0 | 593,877,125 | 2% | ||
monsterrerentals | 0 | 31,892,445,197 | 100% | ||
oasiskp2 | 0 | 10,586,304,861 | 50% | ||
deggial | 0 | 349,557,931 | 100% | ||
ngwinndave | 0 | 15,176,886,500 | 50% | ||
katiebeth | 0 | 450,723,862 | 40% | ||
kasih-sayang | 0 | 905,121,385 | 30% | ||
pof.archon | 0 | 462,600,377 | 50% | ||
hiveecuador | 0 | 16,845,865,982 | 100% | ||
slothburn | 0 | 1,199,259,035 | 10% | ||
freecompliments | 0 | 66,328,674,200 | 100% | ||
hive-140084 | 0 | 112,640,802,205 | 100% | ||
timix648 | 0 | 1,144,291,398 | 70% | ||
briefmarken | 0 | 45,970,888,640 | 100% | ||
converter.bonus | 0 | 858,999,400 | 50% | ||
pepetoken | 0 | 795,763,051 | 10% | ||
ijebest | 0 | 573,663,743 | 5% | ||
bankrobbery | 0 | 626,868,428 | 50% | ||
fc-curation | 0 | 32,437,050,138 | 100% | ||
spoonies | 0 | 39,412,123,685 | 100% | ||
fc-rewards | 0 | 44,459,270,480 | 100% | ||
d-a-d | 0 | 10,538,766,780 | 50% | ||
scentsgalore | 0 | 2,473,383,452 | 100% | ||
tejidorosa | 0 | 449,599,012 | 99% | ||
pepe.voter | 0 | 16,159,602,807 | 50% | ||
blessskateshop | 0 | 57,745,146,580 | 12% | ||
claudiavb | 0 | 18,098,616,847 | 50% | ||
fc-arbitration | 0 | 7,082,058,611 | 100% | ||
murtaza-7868 | 0 | 908,545,688 | 50% | ||
lolz.byte | 0 | 937,470,805 | 100% | ||
dreamtales | 0 | 601,533,512 | 3% | ||
bbarelyseal | 0 | 0 | 100% | ||
indiasierra | 0 | 7,995,916,427 | 50% | ||
partytime.inleo | 0 | 4,179,645,919 | 10% | ||
cryptodelegator | 0 | 913,895,563 | 100% | ||
magicalex | 0 | 2,239,862,676 | 70% | ||
calebmarvel24 | 0 | 2,601,129,515 | 10% | ||
indeedly | 0 | 3,370,688,427 | 50% | ||
pakx | 0 | 660,898,921,300 | 50% | ||
trovepower | 0 | 2,354,275,048 | 50% | ||
mmbbot | 0 | 2,372,777,511 | 50% | ||
digi-alt | 0 | 1,110,085,704 | 50% | ||
michael561 | 0 | 5,498,227,370 | 20% | ||
thecrazygm.bank | 0 | 11,933,898,583 | 100% | ||
longhunter | 0 | 1,912,396,563 | 100% | ||
magic.byte | 0 | 0 | 100% | ||
sports.power.bot | 0 | 0 | 0.01% | ||
savvyfrog | 0 | 751,914,811 | 25% |
This copy paste mistake I have actually made more than I care to admit! I even remember figuring out what that dollar sign was all about 😅 !PAKX !PIMP !PIZZA
author | ecoinstant |
---|---|
permlink | re-thecrazygm-t0yg3z |
category | hive-186392 |
json_metadata | {"tags":["hive-186392"],"app":"peakd/2025.8.3","image":[],"users":[]} |
created | 2025-08-13 23:05:00 |
last_update | 2025-08-13 23:05:00 |
depth | 1 |
children | 1 |
last_payout | 2025-08-20 23:05:00 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.012 HBD |
curator_payout_value | 0.013 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 159 |
author_reputation | 878,239,309,108,880 |
root_title | "Turning a Common Terminal Mistake into a Feature" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 144,976,181 |
net_rshares | 91,068,413,578 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
thecrazygm | 0 | 91,068,413,578 | 100% | ||
endhivewatchers | 0 | 0 | 0.5% |
<center><table><tr></tr><tr><td><center><img src='https://files.peakd.com/file/peakd-hive/pakx/PakX-logo-transparent.png'><p><sup><a href='https://hive-engine.com/?p=market&t=PAKX'>View or trade </a> <code>PAKX</code> tokens.</sup></p></center></td><td><center>@ecoinstant, PAKX has voted the post by @thecrazygm. (1/2 calls)</p><br><br><p>Use !PAKX command if you hold enough balance to call for a @pakx vote on worthy posts! More details available on <a href='/@pakx'>PAKX Blog</a>.</p></center></td></tr></table></center>
author | pakx |
---|---|
permlink | re-ecoinstant-1755126342 |
category | hive-186392 |
json_metadata | "{"tags": ["pakx", "hivepakistan"], "app": "HiveDiscoMod"}" |
created | 2025-08-13 23:05:42 |
last_update | 2025-08-13 23:05:42 |
depth | 2 |
children | 0 |
last_payout | 2025-08-20 23:05:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.018 HBD |
curator_payout_value | 0.019 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 524 |
author_reputation | 165,760,400,741 |
root_title | "Turning a Common Terminal Mistake into a Feature" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 144,976,189 |
net_rshares | 132,402,465,763 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
thecrazygm | 0 | 89,246,045,306 | 100% | ||
cwow2 | 0 | 43,156,420,457 | 10% |
<center>PIZZA! $PIZZA slices delivered: steemmillionaire tipped thecrazygm @ecoinstant<sub>(1/20)</sub> tipped @thecrazygm <sub>Come get [MOON](https://moon.hive.pizza)ed!</sub></center>
author | pizzabot |
---|---|
permlink | re-turning-a-common-terminal-mistake-into-a-feature-20250813t215148z |
category | hive-186392 |
json_metadata | "{"app": "pizzabot"}" |
created | 2025-08-13 21:51:48 |
last_update | 2025-08-13 23:05:21 |
depth | 1 |
children | 0 |
last_payout | 2025-08-20 21:51:48 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.012 HBD |
curator_payout_value | 0.012 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 192 |
author_reputation | 7,757,592,350,400 |
root_title | "Turning a Common Terminal Mistake into a Feature" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 144,974,779 |
net_rshares | 87,460,124,400 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
thecrazygm | 0 | 87,460,124,400 | 100% |
Elegant solution! Love that you share these little puzzles! !PIMP & !PIZZA
author | steemmillionaire |
---|---|
permlink | re-thecrazygm-t0ycpr |
category | hive-186392 |
json_metadata | {"tags":["hive-186392"],"app":"peakd/2025.8.1","image":[],"users":[]} |
created | 2025-08-13 21:51:27 |
last_update | 2025-08-13 21:51:27 |
depth | 1 |
children | 0 |
last_payout | 2025-08-20 21:51:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.012 HBD |
curator_payout_value | 0.012 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 75 |
author_reputation | 128,650,232,391,597 |
root_title | "Turning a Common Terminal Mistake into a Feature" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 144,974,770 |
net_rshares | 85,710,985,922 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
thecrazygm | 0 | 85,710,985,922 | 100% |
That's a great simple and useful tool. Taking into account possible mistakes, and automating error checking and correcting, is brilliant, my friend. 😁 🙏 💚 ✨ 🤙
author | tydynrain |
---|---|
permlink | re-thecrazygm-2025813t214423723z |
category | hive-186392 |
json_metadata | {"links":[],"type":"comment","tags":["hive-186392","dev","bash","archon","tribes","pimp","proofofbrain"],"app":"ecency/3.3.3-mobile","format":"markdown+html"} |
created | 2025-08-14 07:44:24 |
last_update | 2025-08-14 07:44:24 |
depth | 1 |
children | 0 |
last_payout | 2025-08-21 07:44:24 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.012 HBD |
curator_payout_value | 0.012 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 159 |
author_reputation | 211,715,020,170,703 |
root_title | "Turning a Common Terminal Mistake into a Feature" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 144,982,421 |
net_rshares | 83,997,894,224 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
thecrazygm | 0 | 83,997,894,224 | 100% |