I strongly believe that a script should be created to handle any repetitive process in the terminal.
By default, when you create a new script, it does not have executable permissions. So for each script that you create, you then have to chmod the file to be executable. However, its kind of hypocrital to say that a script should be created to replace any repetitive process and then not figure out a way to automate the ‘chmod’ command when creating a script.
Well, as it turns out, a simple addition to your vimrc file will automatically make any newly created script an executable (so long as you have the ‘#!’ in the file).
" automatically give executable permissions if file begins with #! "and contains '/bin/' in the path au BufWritePost * if getline(1) =~ "^#!" | if getline(1) =~ "/bin/" | silent !chmod a+x | endif | endif au BufWritePost * if getline(1) =~ "^#!" | if getline(1) =~ "/usr/bin/" | silent !chmod a+x | endif | endif
So just copy the above code into your .vimrc file (each uncommented line ends in 2 endif commands) and now you can create scripts that are executable by default.
[…] doing any type of programming or scripting, I do my best to streamline everything (see this post and this post). Basically anything I do in the Terminal that can be automated, I try to […]
I think this is one of the most vital info for me. And i am glad reading your article. But wanna remark on few general things, The site style is ideal, the articles is really great : D. Good job, cheers
Rashmi Patel dental license
Automatically make scripts executable | Tech N Comp
Plans are secured for the development of a
swimming center and a much larger building to provide for meetings.
People again turned to astrology during the late 19th h and 20th centuries when spiritualism made
a comeback. Multiple big and small fish populate the waters near
the island, as well as sea turtles and sharks.
my blog: news
news recently posted..news
What’s up to every body, it’s my first go to see
of this weblog; this webpage includes remarkable and genuinely excellent data in favor of readers.
online date recently posted..online date