On 3/22/21 12:25 PM, Bruce Dubbs wrote:
On 3/22/21 10:44 AM, Scott Andrews wrote:

Syntax errors found in /etc/init.d/rc...

Not errors, but someone's preferences.  For instance all the
'Prefer explicit escaping: "\\n"' issues are wrong.  The page
https://github.com/koalaman/shellcheck/wiki/SC1001 says:

Rationale:

You have escaped something that has no special meaning when escaped. The backslash will be simply be ignored.

is not true in these cases.  A \n certainly does have a special meaning.


But it doesn't hurt to escape them either.

\n is a token that means carriage return and linefeed


----

Looking at https://github.com/koalaman/shellcheck/wiki/SC1091 it appears that you are not running shellcheck properly.  It appears that you need to specify disable=SC1091.

----

https://github.com/koalaman/shellcheck/wiki/SC1012

ShellCheck has found a \t, \n or \r in a context where they just become regular letter t, n or r. Most likely, it was intended as a tab, linefeed or carriage return.

To generate such characters (plus other less common ones including \a, \f and octal escapes) , use printf as in the example. The exception is for linefeeds that would be stripped by command substitution; in these cases, use a literal quoted linefeed instead.

var="foo$(printf '\t')bar"  # As suggested in warning

var="$(printf 'foo\tbar')"  # Equivalent alternative

And shellcheck is quite correct,  if there


The thing I did notice is the inconsistency between "." and source

. /lib/lsb/init-functions
[ -r /etc/sysconfig/rc.site ] && source /etc/sysconfig/rc.site

However, the header line is #!/bin/bash and is not an error.

If you really think there is an error, give us an example where the code does not work properly.

  -- Bruce



I am rewriting the boot init files to a standard.

That makes them consistent and less likely to have errors/issues.

This post was about possible syntax errors, not shell scripts not working properly.

Yes I have found that the boot scripts do indeed do not work properly in some cases.

I am still working on /etc/init.d/rc and when I get the first "cut" completed I will post that.

Now if you don ot care a whit about consistency,  errors and issues then maybe posting here is not the best use on my time?

Is posting output from "lint" type tools without merit here and not valid for discussion?

Should I just move along and not share my findings?

You be the judge........


--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to