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
vote
1answer
12 views

How do I script deluge to get information about torrents?

Dealing with a lot of torrents is not always convenient when using GUI. I tried deluge-console info, but that didn't give all the info I wanted. So, to make it clear, what I need is a script, that ...
1
vote
2answers
24 views

Help creating script to move files based on date or filename

I have an FTP process that is constantly putting files into a directory. The date created is part of the filename in a format like this: YYYY-MM-DD-HH-MM-SS-xxxxxxxxxx.wav I would like to move the ...
3
votes
1answer
179 views

is there a way to get the url from current tab in google-chrome?

I used to do that on firefox using a python command, but recently something changed and I can't get the URL anymore! What used to work with firefox: #!/bin/bash current_tab_num () { python2 ...
0
votes
1answer
24 views

Reading file using shell script, format of the line has changed

I am reading a file using the following code: displayLine(){ echo $line } filename="SampleFile" while read line do displayLine $line done < "$filename" The format of the file that I am ...
0
votes
1answer
44 views

cp doesn't work in a script but does from the command line

I have this script for automating a simple process where I scan a number into the command line, grep that number out of a catalog file which gives me a path, and then copy the DVD which the above ...
0
votes
0answers
29 views

How to execute a command after ssh login via batch file

I want to execute a set of commands at once I login to a ssh session everytime via a batch file. Eg: start putty.lnk -load "session" -ssh username -pw password -m <commands> Here I am using ...
2
votes
1answer
52 views

What Command Line tools to connect from Unix to remote Windows?

I need to make some scripts for connecting from a Unix server to several Windows stations for automating file transfers. GUI is not needed and I can't install any additional software into Windows ...
3
votes
2answers
6k views

grep output of expect script

I'm trying to run some expect language, and grep/parse the output all in one script. I want to grep the output of and look for "error" (I should note that standard linux commands like awk, sed, grep, ...
0
votes
0answers
18 views

Script acting as textfile, possible? [duplicate]

A program I'm running has a -logFile option. The file I set as a logfile is filling up quite rapidly, and I only need about half of what's actually in it. Is it at all possible to: have a script ...
1
vote
1answer
960 views

Shell Script Help - Automatically assign users to group

Recently, I have just started to learn linux and I am currently trying to make a shell script that can automate the task of creating user accounts, assigning them passwords and then assigning them to ...
0
votes
2answers
46 views

Command to skip process if file exists

I have been using a for loop to run a pipeline for multiple files but unfortunately the terminal froze halfway. I would like to run the pipeline again but because of time I would like to skip the ...
1
vote
2answers
138 views

View timestamp for CUPS print jobs

I'm looking for a way to view the timestamp of a job in CUPS. I've searched the man pages and can't seem to find it. The long term goal is to have a script that parses the time from the jobID and ...
0
votes
1answer
16 views

Help designing an 'extract - store - feed' workflow

Working with a large volume of files, I would like to automate the process of storing stdout info as a variable that I can feed into as an input for my next process. Specifically, when I put... ...
0
votes
1answer
23 views

How can I create a single shorcut to open a set of programs?

Currently, I have a set of shorcuts to open several applications. I use xbindkeys to do so. I have something like this: Super + u -> sublime Super + e -> pcmanfm Super + s -> skype Super + x -> ...
0
votes
0answers
24 views

Can a Linux server that authenticates against an Active Directory accept public/private keys for passwordless login?

I have a Linux server that authenticates users against an Active Directory. Now interactive logins require username and password and automatic login requires a keytab (Kerberos) for passwordless ...
1
vote
2answers
39 views

How to remove prefixes and suffixes from filenames in a given directory?

I have many files with the same prefix and the same suffix. I want to remove both from filenames. Both contain spaces. So foo bar XXX doo par.jpg, foo bar YY YY doo par.jpg would become XXX.jpg and ...
-1
votes
2answers
42 views

how to login a user using shell script [on hold]

In my computer i have two user(tiger,jenk) now i want to create a shell script for login user "jenk" from user "tiger" i m try this code [tiger@pagaltiger mytask]$ echo -e "IncorrectPassword\n" | ...
0
votes
1answer
30 views

Kill command also kills other process

I have a very simple script, let's call it foo.sh. It's this: #!/bin/sh sxhkd & panel & where panel is a script (I won't post it here because it's very long and I don't think it would be ...
1
vote
2answers
58 views

Stop bash script with any key

I'm writing a custom gnome-terminal profile which I want to stop with any key I choose. After pressing the key, my intention is to complete all my commands at that moment and start su. I've tried ...
0
votes
1answer
21 views

BASH script presenting IF syntax error

for k in {794..800} if [ -f "vesta_$k.xyz" ] then do mkdir $k mv vesta_$k.xyz $k/vesta.xyz cd $k/ <<COMMANDS>> cd .. ...
1
vote
2answers
35 views

legality of creating a variable for a file location

adapter= /Volumes/My\ Passport/Documents/adapters.fa Can I create this variable so that I can just refer to adapter for the exact file (and its location)?
3
votes
2answers
32 views

SSH Connection - Interact with ongoing process

If i open a Terminal window on my desktop and start a job on it and go to work in the morning. Is there a way to connect to the desktop with SSH and interact with the ongoing process in the Terminal ...
0
votes
4answers
39 views

Rename files randomly but without repetition

Suppose i have a folder with a lot of file names some very strange and nonsense I want to rename it like File-1 File-2 File-3 .. I have tried this(echo is for tryng) for name in *; do echo mv ...
0
votes
4answers
53 views

Find files using shell script

I have the below script which looks for the file in the current directory and evaluates to true if the file exists in the directory and evaluates to false if it does not #!/bin/bash printf "\n Please ...
-1
votes
1answer
19 views

Search for and kill process in script

I have written a script to stop a Tomcat instance, remove the .war file and application directory, copy a new .war file from a NFS mount to the webapps directory, and then restart the Tomcat instance. ...
0
votes
1answer
25 views

Rss in full text

I am looking for a way to extract the full text from an html file in the command line. The purpose of this is to make a blocklet for my i3 status bar. I have found some site with names like "Full ...
58
votes
10answers
74k views

Looping through files with spaces in the names?

I wrote the following script to diff the outputs of two directores with all the same files in them as such: #!/bin/bash for file in `find . -name "*.csv"` do echo "file = $file"; diff ...
2
votes
2answers
26 views

Parameter expansion question

I have 2 files each in user/admin/1/2/[a-c] subdirectories. The files are preQC_1.txt and preQC_2.txt - both of which will be inputs in my tool. I use "${f##*/}" for preQC_1.txt in my for loop for ...
0
votes
4answers
53 views

How to log from inside the script along with stdout

I am aware that I can log using tee But I want to log from inside my script, at the same time display the content on the stdout. Example, my code looks something like this: names=$(print("name1 ...
2
votes
3answers
200 views

awk : parse and write to another file

I have records in XML file like below. I need to search for <keyword>SEARCH</keyword> and if present then I need to take the entire record and write to another file.(starting from ...
0
votes
2answers
50 views

How to execute a command on window focus/unfocus?

I'd like to execute xinput disable bcm5974 when Gnome Terminal (and maybe some other application) gets focused, and xinput enable bcm5974 when it loses focus. This is because libinput and my ...
1
vote
1answer
44 views

generate file names in loop [closed]

DISCLAIMER: I am using Mac OSX. The bash script is in a different directory from the files that require processing. From here my struggle begins… HELP 1: I have multiple files each housed in a ...
0
votes
1answer
2k views

How to execute Netscaler commands through a remote machine via SSH connection

I have been trying to execute some NetScaler commands like "bind" & "unbind" through a Linux Box via an SSH Connection. Now the Problem is, Manually we are able to enter & execute commands on ...
0
votes
0answers
43 views

Unix scripting : Writing to another file with “:” is failing

I have below record (and many other such records) in one file 9460 xyz abc (lmn):1027739543798. Taxpayer's identification number (INN): 123. For all IIB. 2016/02/03 I need to search ...
2
votes
2answers
38 views

Renaming a file the moment it appears in a folder

Here's the context : on a samba server, I have some folders (that we'll call A,B,C,D ) which are supposed to receive files from a network scanner. The scanner renders a PDF file named like this : ...
1
vote
1answer
25 views

Use xvfb to automate X program

I originally posted this question here, but upon second thoughts I decided here was a better place for this. I sadly have to use this proprietary program that bundles a camera driver. I want to ...
3
votes
4answers
6k views

Shell Script to Execute Shell Script to All Subdirectories

I am making a script to simplify my daily tasks. Everyday, I have to grep for a few things inside a company server. It was okay, however, now, they have segregated each object into sub directories. I ...
3
votes
1answer
970 views

Compare file size of multiple files in an array [closed]

Scenario: Ftp site has 100s of files. Once a day, all the .gz files are copied to an AWS site then renamed. Only the date is kept in the file name. Some of the files corrupted during copy. A txt ...
4
votes
2answers
196 views

shell script to make directories, subdirectories and files following a pattern

Is it possible to create a script that will create the following structure after running it: /test/1/1 -> A /test/1/2 -> B /test/1/3 -> C /test/1/4 -> D /test/1/5 -> E /test/1/6 -> ...
-1
votes
0answers
41 views

dump unstructured content of file to a csv or excel sheet [duplicate]

I believe it is not duplicate of other thread which we discussed in past. The reason being is: Here we have some rows (Virtual Disk, Physical Disk, device and shareddisk) which are repeating several ...
0
votes
1answer
3k views

How to execute grep in tcl for getting XYZ-123 type pattern

How can I execute this grep command in TCL? grep '[A-Z][A-Z][A-Z]\-[0-9][0-9][0-9]' file1 > file2
0
votes
1answer
13 views

linefeed in bash script - to email

I am doing printf to a logfile and having that logfile send through mailx, however, it seems that the linefeed "\n" are not recognised or captured in the mail. Snippet of script as below (notice the ...
-4
votes
2answers
72 views

Create Directories and Subdirectories as Another User [closed]

I am trying to create directories and subdirectories as another user, from inside a shell script. The problem is, I am running the script as root, so the directory is being created with root ...
1
vote
1answer
44 views

script Multiple Commands

I have a PHP script I'm running from Cron. I want to save its output to file, but also want to save the shell output to a different file. Ideally, I'd like to have this in one line. As such, I tried ...
8
votes
1answer
894 views

Can capabilities be used in scripts without setcap'ing the interpreter binary?

Right now I'm using cap_net_bind_service MY_USERNAME in /etc/security/capability.conf. Now I just need to set cap_net_bind_service+i on the interpreter of my favouite scripting language to be able to ...
0
votes
2answers
46 views

How to delete a line with a given word using SED function

I have a file .txt with inside ID VALUE test value_1 testing value_2 first value_3 second value_4 I'm trying to write a shell script which will delete a line corresponding to a ...
-1
votes
5answers
80 views

Bash script to insert letter based files into directories [closed]

I'll start by saying I'm a complete novice to this. So basically, what I need to do is create a script that makes 15 directories (named from 1 to 15) and inside each directory I have to have a letter ...
29
votes
5answers
7k views

Universal Node.js shebang?

Node.js is very popular these days and I've been writing some scripts on it. Unfortunately, compatibility is a problem. Officially, the Node.js interpreter is supposed to be called node, but Debian ...
0
votes
2answers
37 views

Bash Script execute command as user

I'm just wondering if it's possible to execute a command inside a bash script as a specified user and supply the password in one string. At the moment I have COMMAND="${DIRECTORY}/script.sh" su -c ...
0
votes
2answers
47 views

Correct way to set PERMANENT environment variables from script

I want to do a very simple install process for my app framework. I've got everything working, but I want to set two environment variables. I want to update the PATH and also set a HOME variable. I ...