Как записать этот псевдокод где условие

Я нашел эту статью, которая обсуждает установку под CentOS 6, но большая часть его должна все еще применяться. Статья назвала: Принуждение Таблицы разделов GUID на диске с CentOS 6.

В Вашем запускать файл необходимо будет выполнить в этом Ваш %pre раздел:

%pre
/usr/sbin/parted -s /dev/sda mklabel gpt
%end

И затем удостоверьтесь, что Вы не включаете никого clearpart, позвольте значению по умолчанию установки к использованию "целого диска".

выборка

Затем удостоверьтесь Ваш запускать, не содержит clearpart инструкций, таким образом, это примет значение по умолчанию только к использованию вакуума. Единственная маленькая гнида, которую я нашел после установки, - то, что минимальная опция установки только включает fdisk и не разделенная также поэтому, если Вы захотите справиться с разделами диска, то необходимо будет добавить, что или во время установки или впоследствии поскольку fdisk не поддерживает GPT.

Я полагаю, что Вам, возможно, придется "возвратиться к установщику" путем предоставления ключам Ctrl+Alt+6.

4
13.04.2017, 15:37
2 ответа

Я собирался продлить свой оригинальный код, но он добирается до точки, где гораздо проще просто переосмыслить все в Perl напрямую:

#!/usr/bin/env perl

## This is the path to the target  directories
my $path="/Users/Masi/Dropbox/";

## The target directories
my @directories=("Cardiology","Rheumatology","Surgery");

## Iterate over the directories
foreach my $dir (@directories) {
    my $dd=0;
    ## Read the current directory
    opendir (my $DIR, "$path/$dir");
    ## Find all files in this directory
    while (my $file = readdir($DIR)) {
        ## Reset the counter
        my $c=0;
        ## Skip any files that aren't .tex
        next unless $file =~ /\.tex$/;

        ## Open the file
        open(my $fh,"$path/$dir/$file");

        while (<$fh>) {
            ## Get the subsection. $_ is the current line.
            $sub="$_" and $n=0 if /\\subsection{/;
            ## If this line is a question
            if (/\\begin{question}/) {
                ## If this counter is 0, this is the first file
                ## of this directory, so print the section
                ## Print the section name
                if ($dd==0) {
                    print "\\section{$dir}\n\n";
                    $dd++;
                } 
                ## If this counter is 0, this is the first question
                ## of this subsection, so print the subsection line
                print "$sub\n" if $n==0;

                $n++;
                ## Increment the counter, we want these lines
                $c++;
                ## And print
                print;
            }
            else {
                ## Print lines if the counter is 1
                print if $c==1;
                ## reset the counter to 0
                print "\n" and $c=0 if /\\end{question}/;
            }
        }
        print "\n";
    }

}

Обратите внимание, что это игнорирует подкупки, но это было бы легко изменять его, чтобы включить их.

3
27.01.2020, 20:55

Расширение или улучшение кода Тердона на основе некоторой логики в этом Ответ

#!/usr/bin/env perl

## This is the path to the target  directories
my $path="/Users/Masi/Dropbox/";
chdir $path or die "cannot chdir '$path'";

## Iterate over the directories
foreach my $dir (
    "Cardiology", "Pathophysiology", "Patology and Biopsy", "Physiology",
    "Propedeutics", "Radiology", "Rheumatology", "Surgery"
)
{
    my $dd=0;
    ## Read the current directory
    opendir my $DIR, $dir or die "cannot opendir '$dir'";

    ## Find all files in this directory
    while (my $file = readdir($DIR)) {
        ## Reset the counter
        my $c=0;
        ## Skip any files that aren't .tex
        next unless $file =~ /\.tex$/;

        ## Open the file
        open(my $fh,"$path/$dir/$file");

        while (<$fh>) {
            ## Get the subsection. $_ is the current line.
            $sub="$_" and $n=0 if /\\subsection{/;
            ## If this line is a question
            if (/\\begin{question}/) {
                ## If this counter is 0, this is the first file
                ## of this directory, so print the section
                ## Print the section name
                if ($dd==0) {
                    print "\\section{$dir}\n\n";
                    $dd++;
                }
                ## If this counter is 0, this is the first question
                ## of this subsection, so print the subsection line
                print "$sub\n" if $n==0;

                $n++;
                ## Increment the counter, we want these lines
                $c++;
                ## And print
                print;
            }
            else {
                ## Print lines if the counter is 1
                print if $c==1;
                ## reset the counter to 0
                print "\n" and $c=0 if /\\end{question}/;
            }
        }
        print "\n";
    }
    closedir $DIR  or die "cannot closedir '$dir'";
}

, где я добавил некоторое управление ошибками.

1
27.01.2020, 20:55

Теги

Похожие вопросы