在 bash 中,如何以printf
交互方式获取输入以打印序列。我尝试了以下方法:
read x; read y; printf '%s\n' {"$x".."$y"..5}
0
40
{0..40..5}
我试图得到这样的输出:
printf '%s\n' {0..40..5}
0
5
10
15
20
25
30
35
40
在 bash 中,如何以printf
交互方式获取输入以打印序列。我尝试了以下方法:
read x; read y; printf '%s\n' {"$x".."$y"..5}
0
40
{0..40..5}
我试图得到这样的输出:
printf '%s\n' {0..40..5}
0
5
10
15
20
25
30
35
40
我将 html 文件内容复制到以下形式的文本文件中:
... course 10> user_1 </a><br /><a class="reviewlink" href="https://www.foo.com/moodle/mod/quiz/review.php?attempt=1491">Review attempt<...
... course 10> user_2 </a><br /><a class="reviewlink" href="https://www.foo.com/moodle/mod/quiz/review.php?attempt=1498">Review attempt<...
从这里使用一些shell命令我可以得到内容:
user_1 "https://www.foo.com/moodle/mod/quiz/review.php?attempt=1491"
user_2 "https://www.foo.com/moodle/mod/quiz/review.php?attempt=1498"
到另一个文本文件。
这里...
表示一些大的独特文本。
编辑
为用户提供更详细的表格:
<label for="attemptid_1502" class="accesshide">Select attempt</label></td><td class="cell c1 picture" id="mod-quiz-report-responses-report_r1_c1"><a href="https://www.foo.com/moodle/user/view.php?id=380&course=10" class="d-inline-block aabtn"><img src="https://www.foo.com/moodle/pluginfile.php/419/user/icon/moove/f2?rev=6942" class="userpicture" width="35" height="35" alt="Picture of user 1" title="Picture of user 1" /></a></td><td class="cell c2 bold" id="mod-quiz-report-responses-report_r1_c2"><a href="https://www.foo.com/moodle/user/view.php?id=380&course=10">user 1</a><br /><a class="reviewlink" href="https://www.foo.com/moodle/mod/quiz/review.php?attempt=1502">Review attempt</a></td><td class="cell c3" id="mod-quiz-report-responses-report_r1_c3">meethu</td><td class="cell c4" id="mod-quiz-report-responses-report_r1_c4">text</td><td class="cell c5" id="mod-quiz-report-responses-report_r1_c5">Finished</td><td class="cell c6 bold" id="mod-quiz-report-responses-report_r1_c6"><a href="review.php?q=62&attempt=1502">0.00</a></td><td class="cell c7" id="mod-quiz-report-responses-report_r1_c7"><a href="https://www.foo.com/moodle/mod/quiz/reviewquestion.php?attempt=1502&slot=1" id="action_link5fa01d6f2fd9a29" class="" title="Review response" ><span class="que"><i class="icon fa fa-remove text-danger fa-fw icon" title="Incorrect" aria-label="Incorrect"></i><span class="notanswered">-</span></span></a></td><td class="cell c8" id="mod-quiz-report-responses-report_r1_c8"><a href="https://www.foo.com/moodle/mod/quiz/reviewquestion.php?attempt=1502&slot=2" id="action_link5fa01d6f2fd9a30" class="" title="Review response" ><span class="que"><i class="icon fa fa-remove text-danger fa-fw icon" title="Incorrect" aria-label="Incorrect"></i><span class="notanswered">-</span></span></a></td><td class="cell c9" id="mod-quiz-report-responses-report_r1_c9"><a href="https://www.foo.com/moodle/mod/quiz/reviewquestion.php?attempt=1502&slot=3" id="action_link5fa01d6f2fd9a31" class="" title="Review response" ><span class="que"><i class="icon fa fa-remove text-danger fa-fw icon" title="Incorrect" aria-label="Incorrect"></i><span class="notanswered">-</span></span></a></td><td class="cell c10" id="mod-quiz-report-responses-report_r1_c10"><a href="https://www.foo.com/moodle/mod/quiz/reviewquestion.php?attempt=1502&slot=4" id="action_link5fa01d6f2fd9a32" class="" title="Review response" ><span class="que"><i class="icon fa fa-remove text-danger fa-fw icon" title="Incorrect" aria-label="Incorrect"></i><span class="notanswered">-</span></span></a></td><td class="cell c11" id="mod-quiz-report-responses-report_r1_c11"><a href="https://www.foo.com/moodle/mod/quiz/reviewquestion.php?attempt=1502&slot=5" id="action_link5fa01d6f2fd9a33" class="" title="Review response" ><span class="que"><i class="icon fa fa-remove text-danger fa-fw icon" title="Incorrect" aria-label="Incorrect"></i><span class="notanswered">-</span></span></a></td><td class="cell c12" id="mod-quiz-report-responses-report_r1_c12"><a href="https://www.foo.com/moodle/mod/quiz/reviewquestion.php?attempt=1502&slot=6" id="action_link5fa01d6f2fd9a34" class="" title="Review response" ><span class="que"><i class="icon fa fa-remove text-danger fa-fw icon" title="Incorrect" aria-label="Incorrect"></i><span class="notanswered">-</span></span></a></td><td class="cell c13" id="mod-quiz-report-responses-report_r1_c13"><a href="https://www.foo.com/moodle/mod/quiz/reviewquestion.php?attempt=1502&slot=7" id="action_link5fa01d6f2fd9a35" class="" title="Review response" ><span class="que"><i class="icon fa fa-remove text-danger fa-fw icon" title="Incorrect" aria-label="Incorrect"></i><span class="notanswered">-</span></span></a></td><td class="cell c14" id="mod-quiz-report-responses-report_r1_c14"><a href="https://www.foo.com/moodle/mod/quiz/reviewquestion.php?attempt=1502&slot=8" id="action_link5fa01d6f2fd9a36" class="" title="Review response" ><span class="que"><i class="icon fa fa-remove text-danger fa-fw icon" title="Incorrect" aria-label="Incorrect"></i><span class="notanswered">-</span></span></a></td><td class="cell c15" id="mod-quiz-report-responses-report_r1_c15"><a href="https://www.foo.com/moodle/mod/quiz/reviewquestion.php?attempt=1502&slot=9" id="action_link5fa01d6f2fd9a37" class="" title="Review response" ><span class="que"><i class="icon fa fa-remove text-danger fa-fw icon" title="Incorrect" aria-label="Incorrect"></i><span class="notanswered">-</span></span></a></td><td class="cell c16" id="mod-quiz-report-responses-report_r1_c16"><a href="https://www.foo.com/moodle/mod/quiz/reviewquestion.php?attempt=1502&slot=10" id="action_link5fa01d6f2fd9a38" class="" title="Review response" ><span class="que"><i class="icon fa fa-remove text-danger fa-fw icon" title="Incorrect" aria-label="Incorrect"></i><span class="notanswered">-</span></span></a></td><td class="cell c17" id="mod-quiz-report-responses-report_r1_c17"><a href="https://www.foo.com/moodle/mod/quiz/reviewquestion.php?attempt=1502&slot=11" id="action_link5fa01d6f2fd9a39" class="" title="Review response" ><span class="que"><i class="icon fa fa-remove text-danger fa-fw icon" title="Incorrect" aria-label="Incorrect"></i><span class="notanswered">-</span></span></a></td><td class="cell c18" id="mod-quiz-report-responses-report_r1_c18"><a href="https://www.foo.com/moodle/mod/quiz/reviewquestion.php?attempt=1502&slot=12" id="action_link5fa01d6f2fd9a40" class="" title="Review response" ><span class="que"><i class="icon fa fa-remove text-danger fa-fw icon" title="Incorrect" aria-label="Incorrect"></i><span class="notanswered">-</span></span></a></td><td class="cell c19" id="mod-quiz-report-responses-report_r1_c19"><a href="https://www.foo.com/moodle/mod/quiz/reviewquestion.php?attempt=1502&slot=13" id="action_link5fa01d6f2fd9a41" class="" title="Review response" ><span class="que"><i class="icon fa fa-remove text-danger fa-fw icon" title="Incorrect" aria-label="Incorrect"></i><span class="notanswered">-</span></span></a></td></tr><tr class="" id="mod-quiz-report-responses-report_r2"><td class="cell c0" id="mod-quiz-report-responses-report_r2_c0"><input id="attemptid_1505" name="attemptid[]" type="checkbox" value="1505"
data-action="toggle"
data-toggle="slave"
data-togglegroup="quiz-attempts"
/>
我的网站www.domainname.com
加载 apache2 'It works' 页面,而不是预期的 moode 主页,该主页位于/var/www/html/moodle
. 在moodle目录中有一个索引文件index.php
,但默认不使用。如果我去www.domainname.com/moodle
网站主页来。配置文件/etc/apache2/sites-available/domainname.conf
已启用。如何解决这个问题?
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName www.domainname.com
ServerAlias domainname.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/moodle
DirectoryIndex "index.php"
# <Directory /var/www/html/>
# AllowOverride All
# </Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.domainname.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Ubuntu 发行版命名法是如何完成的?例如,为什么 14.04 Ubuntu 被命名为“Trusty Thar”?同样,所有已发布版本的这种命名法的动机是什么?还有谁是决定名字的权力?
我在 linux 中运行 matlab。在 matlab 中运行脚本时出现以下错误。这里的 RayMet_012007.ray_paths 是位于自定义目录中的输入。
/bin/bash: line 0: type: RayMet_012007.ray_paths: not found
/bin/bash: line 0: type: RayMet_00.ray_paths: not found
Undefined function or variable 'AD'.
我无法弄清楚问题所在。该脚本正在运行。matlab 也安装在自定义目录中。
我想创建一个文本文件,它将添加我将在终端上运行的每个命令作为文本文件中的新行条目。即,我需要记录我在终端中所做的事情。此外,如果我可以将终端中的输出记录以及终端中的输入记录为文本文件,那就更好了。
每次我忘记一个命令时,我都必须在 Internet 上再次搜索该命令。
我可以像上面那样制作一个文件吗?
我找到了类似的帖子,但这些答案并没有解决我的问题。我需要知道我可以在 ubuntu-gnome 中安装自定义 Shell 主题吗?如果是的话,最好的 custo shell 主题是什么?我在哪里可以得到它?在 gnome-tweak-tool 中,我无法在 shell 主题下选择任何内容。任何解决方案?我已经安装了图标主题。
当我尝试在终端中运行 ubuntu-tweak 时,我得到以下信息:
adwaita@adwaita-HP-2000-Notebook-PC:~$ ubuntu-tweak
Attempt to unlock mutex that was not locked
Aborted
adwaita@adwaita-HP-2000-Notebook-PC:~$ ubuntu-tweak -d
[Launcher][DEBUG] Distribution: Ubuntu 14.04 trusty
Application: Ubuntu Tweak 0.8.8-1~trusty1
Desktop:gnome (ubuntu-tweak:84)
Attempt to unlock mutex that was not locked
Aborted
adwaita@adwaita-HP-2000-Notebook-PC:~$
现在要做什么?这是一个错误吗?
我怎样才能列出所有添加到我的系统的 ppa 存储库并将其保存到一个.txt
文件中,这样我就不想花时间搜索用于全新安装的 ppa,我只需在我的.txt
文件中选择一个 ppa 行并附加命令 sudo add-apt-repository
?还有其他方法可以做到这一点,我不想手动提供 gpg 密钥吗?
在 6 个月前完成安装后,我试图/
使用 ubuntu live cd 扩展我的分区。为了安装软件,我的根分区需要 9GB 的空间。根分区的大小仅为 24GB。为了找到一个安全的解决方案,我使用了我的虚拟盒操作系统,从 ubuntu 安装磁盘启动并使用 GParted 扩展根分区后,效果非常好。所以我选择冒险使用我的主机 ubuntu 14.04 LTS 版本。在启动到实时 ubuntu 14.04 cd 后,我能够删除一个 ntfs 分区,它位于我/
的 ubuntu 分区之上。将我的 24GB 空间调整为 61GB 也没有出现任何错误。但是当我重新启动时,它最终出现了一个 grub 救援菜单。我试图找到解决方案,但没有任何效果。
我也做了这个:
sudo mount /dev/sda7 /mnt
sudo mount -o bind /dev/ /mnt/dev
sudo grub-install --root-directory=/mnt /dev/sda
sudo chroot /mnt /bin/bash
# Now within the chroot
sudo update-grub
exit
# Now outside chroot
这也没有帮助。请帮助。