Bash command as variable

前端 未结 5 1040
一个人的身影
一个人的身影 2021-01-24 02:43

I am trying to store the start of a sed command inside a variable like this:

sedcmd=\"sed -i \'\' \"

Later I then execute a command like so:

5条回答
  •  时光说笑
    2021-01-24 03:34

    This is the right way for do that

    alias sedcmd="sed -i ''"
    

    Obviously remember that when you close your bash, this alias will be gone.
    If you want to make it "permanent", you have to add it to your .bashrc home file (if you want to make this only for a single user) or .bashrc global file, if you want to make it available for all users

提交回复
热议问题