Sunday, May 5, 2024
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 674  / 3 Years ago, tue, november 23, 2021, 4:56:55

From the terminal, I like launching my standard working applications ... gedit with my todo-list, firefox and chromium.



To save time, I (1) chain this command into one line, (2) silence all error messages from stderr and stdout with 2&>1 >/dev/null and (3) background the processes with & to regain a clean terminal:



gedit ~/Desktop/todo.txt 2&>1 > /dev/null & firefox 2&>1 > /dev/null & chromium-browser 2&>1 > /dev/null &


It seems to work fine except for one small detail. Gedit opens the todo file as well as a new textfile with the name 2. Are the pipes misplaced?


More From » command-line

 Answers
7

I tend to see >/dev/null 2>&1 and not 2>&1 >/dev/null



Then > is probably key here since the next options for gedit is (a) filename(s).



Man page for gedit states for filename(s):




Specifies the file to open when gedit starts - if this is not specified, gedit will load a blank file with an Untitled label. Multiple files can be loaded if they are separated by spaces. gedit also supports handling of remote files. For example, you can pass the location of a webpage to gedit, like "http://www.gnome.org", or load a file from a FTP server, like "ftp://ftp.gnome.org/robots.txt".




If I read this correctly: the 2 is seen as a filename since a space preceeds it. That would suggest you need the > to tell gedit that it is not a filename that comes next.






I myself would create a script and have the commands on separate lines.


[#33414] Wednesday, November 24, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aveerakfas

Total Points: 106
Total Questions: 148
Total Answers: 129

Location: Monaco
Member since Sun, Jan 1, 2023
1 Year ago
;