Filippo Cucchetto
Filippo Cucchetto

Reputation: 67

How can i convert this sfdisk script invocation in a sequence of commands

I came across this sfdisk invocation

sfdisk {device} <<EOF
label: dos
unit: sectors
4MiB,252MiB,
256MiB,,
EOF

how can i convert this "script' in a sequence of sfdisk invocation? i mean something like

sfdisk ...
sfdisk ...

Upvotes: 0

Views: 325

Answers (2)

Howard_Roark
Howard_Roark

Reputation: 4326

If your question is how to run a sequence of commands in a bash script, the accepted answer to this question is good. ie-

A; B    # Run A and then B, regardless of success of A
A && B  # Run B if and only if A succeeded
A || B  # Run B if and only if A failed
A &     # Run A in background.

If your question is more about generating scripts using thesfdisk utility in general, this question has a good answer that explains how to do that. ie-

To generate an example script, get the setup of one of your disks:

sudo sfdisk -d /dev/sda > sda.sfdisk

Upvotes: 1

confused genius
confused genius

Reputation: 3254

Save the following description of the device layout content to a file[example : sda.dump] and provide that as input .

label: dos
unit: sectors
4MiB,252MiB,
256MiB,,

Example : 
sfdisk {device} < sda.dump

Upvotes: 0

Related Questions