Create a simple line editor
JavaScript (ES6), 15 14 bytes
I don't understand why this is getting so many upvotes!
s=>prompt(s,s)
Saved a byte thanks to Adám's suggestion that I display the original input in the prompt
.
Try It
f=
s=>prompt(s,s)
console.log(f("Edit this ..."))
Bash 4.x, 25 characters
read -ei "$*" t
echo "$t"
Sample run:
bash-4.3$ bash interactive.sh hello world
hello golfing world
hello golfing world
(Line 2 above was the interactive editing, line 3 the output of resulted text.)
APL (Dyalog), 5 bytes
⍞←⍞⋄⍞
This is a tradfn, so to use it, do
∇a
⍞←⍞⋄⍞
∇
And then call it by using a
, after which you supply the starting string, and then you can edit the string.