linutil icon indicating copy to clipboard operation
linutil copied to clipboard

fix: redirection should work on sh

Open maheshrijal opened this issue 1 year ago • 7 comments

<<< is not supported on sh shell

Pull Request

Title

This fixes the bluetooth manager

Type of Change

  • [ ] New feature
  • [x] Bug fix
  • [ ] Documentation Update
  • [ ] Refactoring
  • [ ] Hotfix
  • [ ] Security patch
  • [ ] UI/UX improvement

Description

<<< redirection only works on bash. SInce the shell type of the script is now sh the current redirection fails. This fix should work on both bash and sh

Testing

I ran the script locally to test it works. Further testing might be required.

Impact

The approach with here-string(```) is a better approach and better performance wise because| involves a subprocess

Issue related to PR

  • Resolves #246

Additional Information

Checklist

  • [ ] My code adheres to the coding and style guidelines of the project.
  • [ ] I have performed a self-review of my own code.
  • [ ] I have commented my code, particularly in hard-to-understand areas.
  • [ ] I have made corresponding changes to the documentation.
  • [x] My changes generate no errors/warnings/merge conflicts.

maheshrijal avatar Sep 06 '24 03:09 maheshrijal

I'll take a look, thought there might be some issues with this. A more streamline approach might be necessary.

ghost avatar Sep 06 '24 04:09 ghost

After taking a look at all of the scripts in monitor-control it seems like there are a lot more bashisms than we anticipated, I'm going to make a PR in a bit to change all of these bashisms to posix compliant alternatives.

ghost avatar Sep 06 '24 05:09 ghost

Alright, check out #282 as every bashism will be removed with that merge.

ghost avatar Sep 06 '24 07:09 ghost

After taking a look at all of the scripts in monitor-control it seems like there are a lot more bashisms than we anticipated, I'm going to make a PR in a bit to change all of these bashisms to posix compliant alternatives.

Well yeah sorry about that! I've made that script for my personal use initially and later thought of adding it here! I don't know a lot of stuff on posix and other such practices, but thank you :) , I've added few more util scripts using bash which are really good but yeah I'll try implementing it if this pr gets approved.

guruswarupa avatar Sep 06 '24 12:09 guruswarupa

After taking a look at all of the scripts in monitor-control it seems like there are a lot more bashisms than we anticipated, I'm going to make a PR in a bit to change all of these bashisms to posix compliant alternatives.

Well yeah sorry about that! I've made that script for my personal use initially and later thought of adding it here! I don't know a lot of stuff on posix and other such practices, but thank you :) , I've added few more util scripts using bash which are really good but yeah I'll try implementing it if this pr gets approved.

If you do end up submitting more util scripts please try and keep them posix compliant; if not I'll go through and check occasionally.

ghost avatar Sep 06 '24 12:09 ghost

After taking a look at all of the scripts in monitor-control it seems like there are a lot more bashisms than we anticipated, I'm going to make a PR in a bit to change all of these bashisms to posix compliant alternatives.

Well yeah sorry about that! I've made that script for my personal use initially and later thought of adding it here! I don't know a lot of stuff on posix and other such practices, but thank you :) , I've added few more util scripts using bash which are really good but yeah I'll try implementing it if this pr gets approved.

If you do end up submitting more util scripts please try and keep them posix compliant; if not I'll go through and check occasionally.

Yeah sure.

guruswarupa avatar Sep 06 '24 12:09 guruswarupa

Sorry for the inconvenience. We had a massive restructure of the codebase to improve future development. Because of this can you update your PR to the new structure. Thank you for your assistance and contribution.

ChrisTitusTech avatar Sep 12 '24 18:09 ChrisTitusTech

I'm closing this one. The fix by @nnyyxxxx in #282 should fix this.

maheshrijal avatar Sep 13 '24 05:09 maheshrijal