Jump to content

Bash Scripting question


Recommended Posts

Hello,

 

I am trying to make a little feature that will save me a lot of time in the future. As many know the commands in Linux are extensive and I often forget many commands that I learned in the past - only to have to learn them again. I figured a simple tool to avoid this is to make a little .note file under my /home/user/ and make an alias that would dump what I type to it.

 

In other words:

 

At the prompt I want to type the following:

 

note Whereis - command for locating files

 

This would open my editor, input the string and close the file.

 

I can do it now, but all the alias note does is is open emacs /home/user/.note , the rest I have to input and then manually save. I am not a bash expert and I figured this would be easy enough for someone who was.

 

Appreciated.

Link to comment
Share on other sites

alias note="echo $1 >> ~/notes.txt"

then do

note "Whereis - command for locating files"

 

Notice the speech marks around the new note

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...