Порядок не совпадает с вашим, но следующее помещает указанные страницы в один pdf (с использованием LaTeX):
\documentclass[twocolumn]{article}
\usepackage{graphicx}
\newcommand\putTitlepage[1]
{%
\bgroup
\fboxsep=-\fboxrule
\noindent
\fbox{%
\includegraphics[width=\columnwidth,height=.4\textheight,keepaspectratio]
{#1}%
}\\%
\texttt{\detokenize{#1}}%
\egroup
}
\newcount\myTPcounter
\makeatletter
\newcommand\putTheTitlepages[1]
{%
\@for\cs:={#1}\do
{%
\expandafter\putTitlepage\expandafter{\cs}%
\par
}%
}
\newcommand\putTitlepagesPattern[4]
{%
\myTPcounter=\numexpr#3-1\relax
\loop\ifnum\myTPcounter<#4
\advance\myTPcounter by 1
\typeout{}%
\typeout{Now processing file}%
\typeout{\the\myTPcounter}%
\typeout{}%
\expandafter\putTitlepagesPattern@i\expandafter{\the\myTPcounter}{#1}{#2}%
\par
\repeat
}
\newcommand\putTitlepagesPattern@i[3]
{%
\putTitlepage{#2#1#3}%
}
\makeatother
\begin{document}
\centering
% if you need to specify their names because they don't match a pattern
\putTheTitlepages{titlepage-1.pdf,titlepage-2.pdf}
\putTitlepagesPattern{titlepage-}{.pdf}{3}{10}
\end{document}
Вы можете продвинуться вверх по пути к файлу, сообщив точку монтирования для текущего пути
item=/var/log/thing.log
while [ -n "$item" ] # Stop when we reach the top
do
stat -c %m "$item" # Report the mountpoint
item="${item%/*}" # Strip back one component of the path
done |
uniq # Discard duplicates
При желании все можно сжать в одну строку:
while [ -n "$item" ]; do stat -c %m "$item"; item="${item%/*}"; done | uniq
Вся информация о монтировании для вашего текущего процесса находится в/proc/self/mountinfo
. Лучше посмотри:
# show_mounts [file_or_dir] [show_hidden]
show_mounts(){
tac /proc/self/mountinfo |
awk -v p=$(realpath "${1:-.}") -v h="$2" '
mi ? mi==$1 : index(p,$5)==1 {mi=$2; if(h || !a[$5]++) printf "%-20s %s\n", $5, $9 }
'
}
Пример:
$ unshare -Urm
# mkdir -p ~/junk/dir{1,2}
# cd ~/junk
# for i in 1 2 3 4; do mount -B dir1 dir2; done
# show_mounts dir2
/home2/ahq/junk/dir2 /dev/sdb9
/home2 /dev/sdb9
/ /dev/sdb8
# show_mounts dir2 show_hidden
/home2/ahq/junk/dir2 /dev/sdb9
/home2/ahq/junk/dir2 /dev/sdb9
/home2/ahq/junk/dir2 /dev/sdb9
/home2/ahq/junk/dir2 /dev/sdb9
/home2 /dev/sdb9
/ /dev/sdb8
Конечно, это предполагает, что /proc/self/mountinfo
или один из его ведущих каталогов не был смонтирован поверх ;-)