Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 31713  / 2 Years ago, sun, july 31, 2022, 12:41:24

I have installed lessc via npm, Node.js Package Manager, and when I run lessc from terminal using



lessc /var/www/less/style.less /var/www/css/style.css


it works perfectly.

However, when I put this exact same command in a bash script, less.sh, it returns the error




lessc : command not found.




Also, I need to run this command from a bash script, because incron, a program which I am using to re-compile my less script each time they are modified, is unable to run the command mentioned above, which I believe may be caused by weird methods for handling white-space in the command.


More From » bash

 Answers
4

Where is the "lessc" executable? Do:



type -p lessc


and take note of the directory, and figure out where that directory is added to your PATH. I think that bash and incron do not source your setup files (.bashrc, etc) the same way. Reading the Bash man page, the INVOCATION section describes how bash finds its startup files. A quick grep through the incron source shows that it doesn't mention .bashrc or .bash_profile.



You could change the "lessc" command in your script to:



/actual/path/to/lessc


that you found via



type -p lessc

[#43331] Tuesday, August 2, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gerrin

Total Points: 347
Total Questions: 109
Total Answers: 121

Location: Tanzania
Member since Fri, Oct 29, 2021
3 Years ago
;