You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will work most of the time if you don't quote the variable when using it because bash will interpret it as "split using $IFS," but will break as soon as $IFS changes. However, proper syntax calls for quoting to prevent splitting and globbing, and that will break this method every time.
SOLUTION
Trim the whitespace characters off before using the variable. This can be accomplished a number of ways, I chose to use bash parameter expansion syntax.
Opening this as an issue because a pull request with my current repo would include too many other changes.
ISSUE
When using curl | xpath | awk to retrieve the LAPS password from the API, the resulting value contains multiple leading newline characters.
Example:
Result:
This will work most of the time if you don't quote the variable when using it because bash will interpret it as "split using $IFS," but will break as soon as $IFS changes. However, proper syntax calls for quoting to prevent splitting and globbing, and that will break this method every time.
SOLUTION
Trim the whitespace characters off before using the variable. This can be accomplished a number of ways, I chose to use bash parameter expansion syntax.
Example using the variable set with curl above:
Result:
==aXyl47ctwer6==
The text was updated successfully, but these errors were encountered: