Why yes there is! Let me introduce you to the
install is a GNU-standard application that lets you copy files around and specify certain things at the same time. The short syntax is
install SOURCE DESTINATION.
However, "certain things" are important. You can specify the file mode with
-m xxx (744 for executable and read-only for everybody else). And bash has a couple of tricks for redirecting new files and here-doc for accepting long-form data. Here's a quick example:
install -b -m 744 <(<<EOF
Now you can run
~/testbin and it should echo out.
You can combine this with
sudo for root-owned files or if you want to write as somebody else, you can sudo and use
-o owner flag.
-b flag just creates a backup if you run the command a second time. This is helpful if you're doing potentially destructive tasks.