Need help to script!!!! new to linux

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
RodimusPrime81

Need help to script!!!! new to linux

Post by RodimusPrime81 »

Hello everyone need some help to script this command to the start up but I am very new to Linux Mint and to Linux in general. I am learning as I go. I have a touch screen issue and when I calibrate it with the command when i restart the machine it will make me do it again. here is the command I want to script:
xinput map-to-output 13 eDP1
I know how to use terminal a little bit but I don't much about where to put the scripts etc. Really I don't even know how to add that command to a script either.
Please help
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Need help to script!!!! new to linux

Post by catweazel »

Issue this command in a terminal:

Code: Select all

sudo nano -w /etc/rc.local
Paste your code into /etc/rc.local before the line that reads exit 0

ctrl-o + enter to save, ctrl-x to exit.

Finally, issue this command then reboot.

Code: Select all

sudo chmod +x /etc/rc.local
Make a backup of /etc/rc.local just in case the file gets overwritten by some wayward update.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Need help to script!!!! new to linux

Post by rene »

The previous suggestion is unfortunately not going to work; xinput communicates with the X server, and at rc.local time there is not yet any such thing.

There's a few opportunities for running X startup scripts and the one I'd tend to like best is creating a file /etc/X11/Xsession.d/10custom_map-to-output containing

Code: Select all

[ -x /usr/bin/xinput ] && /usr/bin/xinput map-to-output 13 eDP1
Other opportunities are the display manager's scripts (which would necessitate you telling us in detail which version of Mint you are running) or even the desktop startup applications. The latter would cause the command to be run on login which may be late or too late. Note, I clearly can't test your specific command/issue; it might be the case that you in fact need it as a display manager script if your issue is of a nature where you need this soonest.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Need help to script!!!! new to linux

Post by rene »

Lack of reply and rereading has me wonder if it's useful to provide extra detail. To create mentioned file you can paste into a terminal:

Code: Select all

echo '[ -x /usr/bin/xinput ] && /usr/bin/xinput map-to-output 13 eDP1' | sudo tee /etc/X11/Xsession.d/10custom_map-to-output
After, verify the file to exist and display its contents with

Code: Select all

cat /etc/X11/Xsession.d/10custom_map-to-output
RodimusPrime81

Re: Need help to script!!!! new to linux

Post by RodimusPrime81 »

I have tried the first answer to the question and i didnt work, Idk maybe i missed something but i did follow the instructions. thanks for the advice tho
RodimusPrime81

Re: Need help to script!!!! new to linux

Post by RodimusPrime81 »

I have Tried the last Answer to my question and it seem to work I will keep you posted sorry for my delay in replying I have been very busy with work and school to even get on my machine. Thank you for you help
Locked

Return to “Scripts & Bash”