如何使用Bash Script在Firefox中打开不同配置文件中的URL?

使用脚本在Firefox中自动执行某些任务。

这些任务应该通过干净的Firefox配置文件运行,因此它们很快并且不会干扰我的任何常规冲浪。

#!/bin/bash # Launch clean firefox profile with parameters: # -no-remote don't connect to any running instance of firefox # -P run firefox through a profile firefox -P 'Another Profile' & sleep 4 # wait for firefox to load # Open URLs firefox -new-tab 'http://askubuntu.com/users' firefox -new-tab 'http://askubuntu.com/badges' 

不幸的是,我无法在配置文件“Another Profile”中打开URL。 相反,Ubuntu使用我的默认用户配置文件启动Firefox并在那里打开它们。

有关如何在“另一个档案”中打开它们的任何建议?

如果省略配置文件, firefox将在您打开的某个Firefox程序中打开该URL。 你必须明确提到它:

 firefox -P 'Another Profile' http://example.com/ 

您还可以一次打开多个URL并将其组合,从而无需睡眠:

 firefox -P 'Another Profile' http://example.com/ http://example.net/ 

我为解决你提到的问题所做的一件事是打开一个带有简单javascript重定向的本地html文件。 我在配置文件中打开firefox并将该本地html页面作为url。

这是我在html文件中用来重定向到我的宏的代码示例。 我确信有更好的方法,但这对我来说现在已经足够好了。 哦,我也使用关闭所有其他标签来清除初始页面。