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)

-1
votes
1answer
23 views

adding date to beginning of file name using script

I have multiple files that need to be renamed with a date added to the beginning of the file name that I am trying to script. I'm using the cp command because I need to keep the original file I need ...
-2
votes
2answers
65 views

Keep CPU busy at certain percent (to prevent CPU buzzing frequency noises) [closed]

On Dell Inspiron 7559 there is electric buzzing from beneath the keyboard that changes frequency when I touch the touchpad. However, if the CPU is busy I hear no buzzing as the frequency gets out of ...
0
votes
0answers
56 views

Executing remote code with arguments

Why this: ssh -i ~/.ssh/master.pem ec2-user@xx.xx.xx.xx 'bash -s' < `dirname $0`/elements/"$element" returns hostname.sh test-5000: No such file or directory when $element is not a just a single ...
0
votes
2answers
49 views

List Most Recent File per Sub-Folder

I have a File structure of : FOLDER/SUB_FOLDER/Text_File I have over 1k+ FOLDER and each FOLDER has at least 2 different SUB_FOLDER with each SUB_FOLDER their own Text_File. I'm trying to ...
6
votes
3answers
78 views

sed/awk subscript numbers in chemical formulas using markup tags

I have hundreds of text files that include chemical formulas together with narrative including numerical values. The formulas are always preceded by white spaces but can be followed by white spaces, ...
0
votes
1answer
36 views

How can I avoid being prompted for a password in this script? [duplicate]

I’m using Amazon Linux. If I login as my “otheruser” user, and create a script, test.sh, with this text sleep 5 ; sudo reboot now I can login and run the script like so … [davea@mydevbox ~]$ sudo ...
0
votes
1answer
29 views

Source ~/.bashrc when using the shell recorder `script`

I am using the first answer from How to automatically record all your terminal sessions with script utility to record my terminal sessions, however, I can not figure out how to get my bashrc to be ...
0
votes
1answer
81 views

Parse xml returned from curl within a bash script

I've been digging through stackexchange for the past few days and I've found bits and pieces of what I'm trying to accomplish, but I'm unsure how to put it all together... I'm trying to create a ...
0
votes
1answer
34 views

How to Wget with Subset Condition?

I want to download a subset of data recursively in the website that is within HTML class .container current main page in .container daughter pages of links also in .containers in daughter pages ...
3
votes
1answer
48 views

How to revoke access for a particular user?

How can I revoke all access (r,w,x) for a particular user to a file or directory tree (while still giving read permission to others)? Does setfacl with mask allow this ?
0
votes
1answer
23 views

Script which reacts to interrupt signal [duplicate]

How to make a script, which will write a string "signal caught" after sending 'interrupt signal' (after pressing ^C on the console, where the script was executed). On top of that after pressing third ...
-3
votes
1answer
69 views

Script to clean log files does not delete them

Could someone explain to me why this script does not delete /var/logmessages and /var/log/wtmp files? I found it on tldp.org tutorial #!/bin/bash LOG_DIR=/var/log cd $LOG_DIR cat /dev/null > ...
0
votes
0answers
21 views

Automated port change

I want to Create a Bash file that a user can execute to change the port a service runs on. Essentially all I have to do is replace a number in a line of text with another number generated by a list. ...
0
votes
1answer
19 views

The unalias in the Mysql Backup script

Here's the script to back up Mysql database. #!/bin/bash FILE=minime.sql.`date +%F` DBSERVER=127.0.0.1 DATABASE=wordpress USER=root PASS=789789 unalias rm 2> /dev/null rm $FILE 2> /dev/null ...
1
vote
1answer
20 views

Mean and variance of words pronounced

I'm working on linguistics and am trying to calculate the average sentence length and how much this average varies. I worked to leave always one sentence per line For instance: La dernière fois ...
0
votes
2answers
36 views

Copying script files using wildcards

We have an SFTP location which is shared by two processes. Now we have a situation when we need to filter based on the filenames before copying. ClientA12345.out ClientA44378.out ClientB23478.out ...
0
votes
0answers
12 views

Bash script not passing variable through ssh [duplicate]

I'm trying to write a script that will ssh into multiple servers and echo the line user_pref("plugin.state.java",2) into every user's firefox pref.js file. I keep getting the error bash: ...
3
votes
2answers
131 views

How to extract strings from one file into multiple files

I have a file, xxx.lst with the following data: aaa 111 bbb 222 ccc 333 I need to make 3 files called 111.lst, 222.lst and 333.lst respectively with aaa in 111.lst bbb in 222.lst and ccc in ...
0
votes
1answer
46 views

Copy last n-lines from one file to another

In the context of adding the same lines at end of the .bashrc or .vimrc files of several user accounts on the same machine, what would be an easy way to copy the last n-lines from one shell script to ...
0
votes
1answer
21 views

Count ONLY alphanumeric words in a specific column of a file

It's essentially what the title says - I'm given a test file and am supposed to be able to count the words in a specific column of a file. The catch is that there are some lines that contain only ...
0
votes
2answers
41 views

Command to merge all terminal windows?

Is there a terminal command that merges all open terminal windows into one window with tabs? Been searching all over the place, but have yet to find any solutions.
-1
votes
1answer
33 views

negation equivalence

I have this exercise: Write a script, which uses if-then-else-fi and accept sequence of parameters -a and -b with values "true" and "false", while for every pair writes negation of expression -a ...
0
votes
1answer
41 views

How to execute a script on SSH Login or device bootup/shutdown? [duplicate]

I have a raspberry pi, which is online and connectable by SSH. What I want to do is create hooks for the following states: When the device starts Before the device shuts down When an SSH login ...
1
vote
1answer
36 views

How can I get my bash script to remove the first n and last n lines from a variable?

I'm making a script to preform "dig ns google.com" and cut off the all of the result except for the answers section. So far I have: #!/bin/bash echo -n "Please enter the domain: " read d echo "You ...
0
votes
2answers
117 views

Unable to execute bash script inside expect script

i have a expect script like #!/usr/bin/expect ..... spawn passwd expect "password:" send "password" .... .... .... ~/test.sh Wile executing this, I'm unable to run bash script test.sh. How to ...
-2
votes
1answer
66 views

quick and easy way to comment out multi lined print statements

Is there a quick and easy way to comment out multi lined print statements? something like this? printf("3387 strings_line_tokens[lower_bound_of_big_boy_counter] %s \n", ...
0
votes
1answer
41 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
36 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 > ...
0
votes
0answers
23 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
47 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
37 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
45 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
34 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
75 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 ...
0
votes
1answer
33 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 ...
1
vote
1answer
76 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
30 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
26 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 ...
0
votes
2answers
24 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
289 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
79 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
28 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
64 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
0answers
15 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
29 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
60 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 ...