A script is a sequence of commands or instructions that are executed by an interpreter program rather than compiled into a standalone executable program.

learn more… | top users | synonyms (2)

0
votes
1answer
43 views

practice linux for practical use [closed]

I have learned and studied linux for 6 months with books like 'The linux commandline'. But, I'm just student, not a business man. When I study linux and do not use it for long time, I always forget ...
3
votes
1answer
44 views

Why does this fish script does not run from a launcher?

I've written the following script, intended to start a daemon and display a Zenity window, then stop the daemon when the window is closed: #!/usr/bin/fish if not ps aux | grep [s]erviio > /dev/...
0
votes
0answers
28 views

How to generate following output file by using PBS script language?

I need to run interacting job with such specifications by using PBS on the cluster. This job must write the output file, in which there is following information (I have not specify this in the .pbs ...
-1
votes
3answers
49 views

In a bash shell script , how to write a loop that goes trough three values [duplicate]

I'm trying to write a shell script using bash for the following problem: Write a loop to go through three values (A B C) and displays each of these values to the screen (hint use a ‘for’ loop). ...
1
vote
1answer
35 views

code to display the text TRUE

I'm a complete newbie and I'm starting to learn the basic for shell scripts. So I apologize if this question is very simple for most users. I'm trying to display the text TRUE to the screen if a file ...
3
votes
1answer
49 views

Command line: crop PDF to paper size (Fedora)

Tools like pdfcrop (from texlive) are great but they seem to be too focused on removing margins/white space. I'm trying to crop a set of letter pages (8.5x11 inches) to a size of 6x9 inches. I want ...
1
vote
0answers
39 views

Command that works fine typed into terminal does not work as a bash function [duplicate]

I have a function which is meant to keep a record of every program I've installed (really, I'm interested in keeping track of dependencies). I've tested out my command in a terminal and it works just ...
0
votes
1answer
46 views

loop port variable to connect to multiple computers

I have a few raspberry pi's creating reverse ssh tunnels on an ssh server. From that server I can connect on all the raspberry pi's. I want to create a bash script that will run on this ssh server, ...
-3
votes
1answer
39 views

How do i create a sed script to prompt the user to replace a number in a file? [duplicate]

I'm new in Unix, and I'm learning about sed command. I need to write a very small script for searching a number in a file and replacing it. I tried doing grep, and than deleting the specific phone ...
1
vote
1answer
85 views

How to move a file if the folder name contains the filename

I am very new to shell scripting in linux. I have a bunch of files in source directory. I have to move the files to the target directory where the folder should contains the file name(not exact match)...
0
votes
1answer
36 views

Shell script getting 'permission denied' despite using umask 000 before command

I have a shell script (build.sh) that ends by attempting to copy some files into a new directory. However it says: mkdir: cannot create directory ‘/files/ondisk/shared//comp/auto/bleeding-1169-...
1
vote
1answer
103 views

How / Is it possible to install python in a portable way?

I'm working on a python script which takes care to migrate a mysql database with a certain schema / structure, into a postgresql database with a different structure. During the development phase I ...
3
votes
2answers
105 views

Writing a script that gives how much lines have “X” and “Y” in it?

I'm doing a course in Linguistic and I would like to use shell scripts to help me doing few repetitive things such as counting who asks questions. Here is part of the file I opened and work with the ...
1
vote
2answers
32 views

Looking for a pattern with conditions

I have a huge file in which I want to look for a word, say pattern. I'm trying to illustrate my case with an example. Suppose I have in my file somewhere Sample-pattern="abc" I want to write a ...
0
votes
1answer
79 views

Creating Unix script to sleep better

I know that I try to work to late in the night and that at this time I'm absolutely unproductive, I work for 5 minutes then switch to a link seen on youtube, then come back to my work, waste some more ...
2
votes
0answers
30 views

Producing the next available filename for a pattern (02-output.log etc)

I can use mktemp(1) within a shell script to make a temporary file in a directory with a suitable suffix & prefix. Is there a command that, given a pattern (e.g. NN-output.log) will look for 01-...
0
votes
2answers
26 views

Shell script - child - background process

I have the following situation : As root Script_A.sh is run on the server and sleeps until triggered. When triggered, it calls Script_B.sh, which loops on the server to determine which actions it ...
4
votes
2answers
298 views

awk - combine two filters into one

I have this variable in a bash script on ubuntu 12.04 which is set to show the available MB on the root partition: AV_MB=$(df -m |awk NR==2 |awk '{print $4}') Is there an elegant way to combine ...
1
vote
3answers
94 views

How can convert characters into characters that'll produce beep noises?

I'm new to Linux and have recently started working on my very first (very simple) project - a morse code generator. I've been able to get the translation working, and now I want to take the next step. ...
-1
votes
2answers
34 views

collect and create tab separated matrix

I have 6 text files (each corresponds to a specific sample) and each file looks like this: Gene_ID Gene_Name Strand Start End Length Coverage FPKM TPM ENSMUSG00000102735 Gm7369 + ...
1
vote
1answer
101 views

bash scripting - wget or curl file with action based on the status 200 or not

I would like to write a script where I try to download a file with wget (or curl if is really not something that can be done with wget) and do 2 actions if the file exists and it's downloaded ...
1
vote
1answer
20 views

Rolling job scheduler

I have a number of servers that I want to perform the same jobs on, one server per day, once the final server has been acted upon the script should return to server1 and start over again. The jobs ...
0
votes
1answer
31 views

How to implement config file expiration time?

I have a Debian server which runs a service using multiple config files (in a similar way to apache2) which I need to add an expiration date to. The config file that has an expiration date starts with ...
0
votes
1answer
69 views

bash script to replace server short names in a file with fqdn

I have a rather large config file that has server short names in it like this: [host 1] host = server1 [host 2] host = server2 [host 3] host = server3 I need to replace all the server short names ...
-2
votes
1answer
43 views

Replace character X with character Y in bash string

I am making bash script and I want to replace one character with another character in my string variable. Example: #!/bin/sh string="a,b,c,d,e" And I want to replace , with \n. output: string="...
1
vote
5answers
183 views

How to print nth line after match / empty lines

I'm trying to write a short script that finds empty lines and then prints the nth line after the empty lines. For foo1 foo2 foo3 bar1 bar2 bar3 spam1 spam2 spam3 eggs1 eggs2 eggs3 printing ...
0
votes
1answer
61 views

Bash script to read and replace string(external ip) at end of ssh config

Im in need of a script to get external ioaddress and replace at the end of an ssh config file I have so far #!/bin/sh IP=$(wget http://ipecho.net/plain -qO-) For a variable I can echo but need a ...
-2
votes
3answers
68 views

Bash script that takes a directory name as a command line argument!

Write a Bash Script that takes a directory name as a command line argument and clean the directory by removing all the files with a zero length, with a .tmp or with a .swp extension that is found in ...
0
votes
1answer
86 views

Systemd vs rc.local for a startup script post installation? (completely hands free)

I have a custom Ubuntu Server ISO that answers installation questions via preseed and kickstart files. It also installs additional .debs I've placed on the ISO during the actual installation as well. ...
0
votes
0answers
30 views

How to add a new inittab entry - a script

vi /etc/inittab startfoobar:3:respawn:/root/startfoobar.sh # added this line telinit q But the /root/startfoobar.sh doesn't starts. Why? SLES 11. What am I missing? cat /root/startfoobar.sh sleep ...
1
vote
1answer
39 views

deny use of multiple getopts arguments

I'm trying to figure out a way to deny the usage of more than one getopts args in a certain situation. Say we have something like this: while getopts "a:b:c:def" variable; do case $variable in a)a=$...
-1
votes
1answer
43 views

How to check if a directory exists I don't know the exact name of it with a bash script

I need to check if a directory already exists, in this case the one with a number suffix, and I won't know the exact number. Example directories to search: /usr/ names names.backup names.20160316 [...
1
vote
3answers
171 views

shell scripting with large amount of files - timelapse

I have created a shell script to capture images every minutes on my raspberry pi. I think something is not quite right as it has been taking pictures but not saves them. I wonder if someone could just ...
0
votes
1answer
34 views

Bug in shell script for printing the tree-like structure of the curent diretcory

I have wrote the following script: #!/bin/bash if [ $# -eq 0 ] then read current_dir else current_dir=$1 fi function print_tree_representation () { for file in `ls -A $1` do ...
1
vote
1answer
50 views

Update apt-get cache only if it's older than certain time

I'm on debian. I would like to execute an apt-get update (and maybe something else) only if the time since last update is bigger or smaller than a certain amount with a straight command, no cron ...
0
votes
2answers
113 views

What's the best way to edit a file with a bash script?

Using /bin/bash on RHEL 5.8 and I want to automate editing a file. I need the script to search the file and replace a line in the file. Line example: Other line Current date 01121990 Other line ...
0
votes
0answers
12 views

Linking and combining text from different documents into dynamic document

I am taking notes on many, related topics from multiple sources. For instance, one of the sources is a textbook on machine learning. I type the notes in an .odt document (but whatever, it could be ....
0
votes
1answer
36 views

My if bash script always execute the break

I`m making a script to rename files in a folder. The new name for the files is in a config file. I have to be sure that the file I want to rename corresponds to the current one in the config file. My ...
1
vote
2answers
63 views

Change Directory and execute command automatically then change directory back out

I'm attempting to write a script that will be run in a given directory with many single level sub directories. The script will cd into each of the sub directories, execute a command on the files in ...
0
votes
2answers
70 views

If filename has more than n characters, delete the last ones

I'm kinda new with the unix shell, and I don't seem to find the answer of my problem : I have a folder containing multiple files : a correct filename contains exactly 13 characters (numbers + letters ...
0
votes
0answers
27 views

How to move a postgresql backup dump to an other server with a script?

I have on a ubuntu 14.04 Server some Backup Files from a PostgreSQL Database. How Can I move this with a daily backup script to an other server? I need a script that moves my files in path /example/...
-4
votes
2answers
59 views

get the input from a script and echo it to another file

I have a python script that create some files and it ask me to enter a password this script is called from bash script is their any way to get the entered password and echo it to text file
-1
votes
2answers
39 views

Why would a user not be able to delete a file they created

Reposting the question about deleting a file. We have a script that is used to transfer files between two SCO Unix systems. The script has been rock solid for years. Recently the firewall unit at ...
0
votes
2answers
140 views

How to output some data to different cells of an Excel File?

Example: I have a file that has following data: cvrta2100 Error 404 Fixed cvrta2111 Licensed Needs Fixing cvrta2123 Error 404 Fixed cvrta2333 Licensed Needs Fixing I am using awk to print ...
0
votes
0answers
26 views

Simple xdotool UI automation login script in Debian 8 VM on Windows 10 host doesn't work when VM starts for first time after Windows BSOD

I do time-lapses with computer scanners using VueScan in Debian 8 VMs using VMware on a Windows 10 host workstation. I made a script that runs when the VMs start up that mounts a Windows network share,...
3
votes
2answers
46 views

Searching /usr/dict/words to find words with certain properties

I would like to write a script to search through /usr/dict/words to find all words that meet some criteria I specify. For example, finding all palindromic words (like "racecar", "madam", etc.) or ...
1
vote
1answer
57 views

Execute an online script gracefully

Context I've set up a site to post scripts to which I can then execute later using the following command: curl -so /tmp/script http://scripts.programster.org/scripts/1?output=raw && . /tmp/...
0
votes
0answers
34 views

Boot portable linux image and auto run script from bootable usb

So I was wondering of the if there was anyway for be to boot up a portable linux OS and have it autorun a script after it loads up. I was hoping to use something simple such as TinyCoreLinux or ...
1
vote
2answers
57 views

Wait until gnome-terminal ends

I'm trying to implement a script who runs four terminal window in parallel using this function gnome-terminal -e sh -c "python scraper.py". I would like to know if there's a way to wait until each ...
0
votes
0answers
14 views

journald 'forgets' correct unit name for shell-based units?

With a unit file like this one here, and an (exectuable, with shebang) shell script as named: [Service] Type=oneshot ExecStart=/some/shell/script.sh I get journal output like this: Mar 10 17:11:27 ...