2
votes
2answers
65 views

How to format textutil -excludedelements

I use Geektool on the Mac to display various information on my desktop. One feature of Geektoool is the ability to use shell mode to launch custom scripts or commands. I am not versed in any type of ...
1
vote
2answers
260 views

Supply input to a program with a password prompt

Is there any Linux command which supplies multiple enter keys to another process which is running in a terminal till the other process dies? For example consider the command yes ' ' | ./ssr-sim ...
0
votes
1answer
121 views

Bash script for copying text currently entered to prompt

I'm trying to minimize using of mouse. Copying text in terminal is the mostly inconvenient activity for mouse avoiding. Now, tmux helping me to obtain this purpose. However, I regularly needs to copy ...
2
votes
2answers
118 views

Show a sliding window of output from a program

I want to run a command (rsync -av) and only display 10 lines of output at any time. I have found a similar post, but I don't want to redirect it to a file. I want the output to be displayed ...
3
votes
5answers
644 views

What are the special characters to print from a script to move the cursor?

I found that by printing \r from a script the cursor moves to the beginning of the line. What character will move the cursor up one line? Where is a list of these special characters? EDIT: Working ...
2
votes
3answers
231 views

How can I tell echo/printf in Bash to swallow escape codes, based on a condition?

I have a Bash script that is being run interactively and as a cron job. When run interactively it outputs colored text on the terminal. However, when run in cron it doesn't have a terminal and ...
6
votes
2answers
891 views

Detect if running in a virtual terminal?

I'd like to autologin to tty1 on login and then use vlock to lock it. How can I detect from Bash if the current terminal is a console virtual terminal (e.g. tty1), so that I can put the vlock line ...
5
votes
1answer
303 views

A program that runs in a shell (e.g. pine) vs. a shell script

Having a bit of trouble finding the answer to my question, perhaps because I may be asking the wrong question. I understand bash scripts. I write them all the time to do little helpful things ...
0
votes
1answer
379 views

List of 'if' switches anywhere? [closed]

Is there a list of all the if switches for use in bash scripting? Sometimes I see someone using it and I wonder what the switch they're using actually does. Example is the -z in this one. I know how ...
1
vote
1answer
75 views

Scrot command - how to save only thumbnail

I'm using scrot to take screenshots from terminal. However when I want to generate thumbnailed version using parameter -t, I got two files: screenshot.png and screenshot-thumbnail.png. How can I ...
6
votes
3answers
553 views

“Friendly” terminal color names in shell scripts?

I'm aware of libraries in languages such as Ruby and Javascript to make colorizing your terminal scripts easier by using color names like "red". But is there something like this for shell scripts in ...
3
votes
4answers
242 views

Show video files with its size

I need all the .mp4 files' dimensions to be printed with the file name. For example: 1_VIDEO.mp4 1204x680
1
vote
3answers
2k views

How to execute more than one command in a newly opened terminal?

I have a script that I want to use to open new terminals and type commands in them. A command like gnome-terminal opens a new terminal. Also, if I do gnome-terminal -e myprogram1 it will ...
2
votes
1answer
770 views

Use the terminal's autocomplete path feature for input to a shell script

I want to make a script that: (1) Gets a path giving the user the ability to use tab to autocomplete, then (2) gets a filename from the user, and then (3) creates a file at that path with extension ...
4
votes
1answer
310 views

output while reading keyboard input

I'm trying to write a script that will ssh into a box, start a processes that needs to be monitored (by a human) for success or failure then move onto the next box and repeat. I've been trying to use ...
10
votes
3answers
23k views

How to append multiple lines to a file with bash

I am writing a bash script to look for a file if it doesn't exist then create it and append this to it: Host localhost ForwardAgent yes So "line then new line 'tab' then text" I think its a ...
7
votes
1answer
249 views

“w | tail” chops text at right margin (78 characters)

Summary: w | tail chops rows after 78th column. When I run the "w" command, it works as expected. However, when I pipe the output to "tail", it chops the output to 78 columns wide (truncates anything ...
1
vote
1answer
290 views

Is there some sort of “no newline at eof” rules for bash scripts?

I have two files, an env file and a run file. When I deploy them to my Ubuntu Server box I get the error: ./start-admin: line 10: syntax error: unexpected end of file If I deploy and then add a ...
1
vote
3answers
116 views

UNIX be-spoke Shell-Script / Commands

Sorry in advanced if this question would be better suited on SO. Basically, I'm getting used to using the command line interface (linux etc..) and I come across commands like: git [command] .. ...
0
votes
1answer
289 views

Run a script after some command were executed

I have a list of scripts ./myscript <param> | grep "asd" ./myotherscript <param> <param> > file ... How can I automaticaly run another script when one of these command in the ...
7
votes
4answers
4k views

Parallel execution of a program on multiple files

I have a small script that loops through all files of a folder and executes a (usually long lasting) command. Basically it's for file in ./folder/*; do ./bin/myProgram $file > ./done/$file ...
1
vote
1answer
907 views

Running shell commands in .sh file results to error

I have two following linux shell commands: echo 'CPU type and model' cat /proc/cpuinfo | head -5 | tail -1 When i run these commands directly in Terminal, i get this result truly: CPU type and ...
1
vote
1answer
242 views

Background script run at login interrupted when I run tmux in terminal

In ~/.profile I run a script in the background (redshift for changing the screen temperature at night time). After logging in, I can open a terminal, and run tmux. However, at this point, redshift ...
2
votes
2answers
269 views

Why does “$i | sed” not work?

I have this code: if [ $i | sed -e "s/^.*\(.\)$/\1/" = "/" ] then echo "folder" else echo "file" fi where $i is something like this app4/ The code above should get the last char of the ...
3
votes
1answer
558 views

wait for autossh connection to complete

I'm trying to create a script that runs a few commands that take a long time to execute and require a constant connection, but autossh user@server wait $! #or wait ${!} commandA commandB doesn't ...
2
votes
2answers
334 views

How do I prevent a script from terminating when the shell exits?

In particular, I created a script to start Firefox which I double-click and choose 'Run in terminal,' but when the shell exits Firefox is killed immediately. How do I prevent this from happening?
3
votes
1answer
323 views

Conditionally killing a process based on its output

I have a REPL (read-eval-print-loop) for the Clojure programming language listening on a network socket. I can send it code over the network and the code will be evaluated and the answer sent back to ...