Hello all I have an interesting problem here that I can't seem to figure out. Note this exists inside a script with the following header: m#!/usr/bin/sh
What I am trying to do is build an automounting script for USB hdd's, the idea is that the user plugs their drive in then runs the script. The script looks at dmesg and seaches for the lines that contain the drive information. From those lines I pull what USB location the drive is attached to, this is where I am having an issue:
The problem as far as I can figure is that I have single quotes inside of single quotes (inner marked in red), if I remove that cut statement I get exactly what I expect with the extra stuff on the back end I need to cut off; otherwise it brings in the entire line ignoring both cut statements.
In addition I am also trying to assign that to a variable inside the script something along the lines of this:
Which Operating System and version are you running?
Hard to follow a script which has a problem.
Can you post a sequence of commands which when typed at a keyboard output the value required?
Dodgy syntax. Is it safe to assume that the period is just the target hostname blanked out? Is the "dmesg" command to be executed on a remote computer?
Essentially, you are generating a script dynamically, sending it over to the host for ksh to run. Don't forget something like ". ./.profile" if you need snvironment. I favor single quotes unless I want variable expansion, as they have fewer metacharacters. Parens are very nice for this, as you can mix in all sorts of commands, and as always, you can preview the created script for validity: