LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-02-2019, 04:21 PM   #1
CatDog
LQ Newbie
 
Registered: Oct 2018
Posts: 15

Rep: Reputation: Disabled
need to make a macro (or script) for bash


I'm running Linux-Lite 4.2 the shell is bash.
I need to make a macro, or perhaps its called a script, to allow me to enter "python3.7 app.py" into terminal when I press a key combination.

I tried installing a program called autokey. I tried installing it several different ways but I keep getting errors when trying to run it.

I can't find any other program that inserts a line of pre-written text when pressing a key combination. I can't put the line of text in clipboard and paste because I am already doing that constantly for another part of this process (hard to explain).
Point is, since I only need to insert this text into bash, is there a way bash can be setup to perform this macro?

Otherwise does anyone know of an alternative to autokey?
 
Old 03-02-2019, 04:31 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
well if you got to press keys then try using an alias in your .bashrc
Code:
alias pyme="python3.7 app.py"
or whatever ...
 
Old 03-03-2019, 04:00 AM   #3
CatDog
LQ Newbie
 
Registered: Oct 2018
Posts: 15

Original Poster
Rep: Reputation: Disabled
thank you, I never knew about this thing called alias. I did alias a='python3.7 app.py' so I just hit a and enter. It's one of those super repetitive tasks where I am doing this over and over for hours (again, it's hard to explain what I am actually doing). and when i close terminal the alias disappears (which is good, I only need the alias for this one task). I'll look into modifying the .bashrc if I ever need to make a perma alias. Anyhow, thank you, how do I mark this post as solved?
 
Old 03-03-2019, 02:23 PM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
if you just add that to your .bashrc file which ever terminal you open it is there at your disposal.
marked solved in the top of your post there is a link saying marked solved.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] GNU Make: Using % in a pattern-rule macro SexyBachelor Linux - Software 3 06-03-2012 04:33 AM
Bash macro expansion in aliases jhwilliams Linux - Software 2 06-10-2009 04:13 PM
LXer: uploading with an ftp macro script LXer Syndicated Linux News 0 02-12-2006 08:01 PM
IPW2200 Make error macro "create_workqueue" passed 2 arguments, but takes just 1 jplev22 Linux - Wireless Networking 2 09-16-2005 11:34 AM
#defining a macro inside a macro? saravkrish Programming 1 05-24-2005 09:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration