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 (1)

0
votes
0answers
4 views

Telnet no echo output from xinetd script

I have have installed xinetd, and I wrote a script: #!/bin/bash echo "Some text" touch /home/somefile I made a service configuration under /etc/xinetd.d/ and basically it works when I connect to ...
0
votes
1answer
17 views

Bash script: test command -o option

I have a piece of code like this: count=0 until [ -f $filename -o $count -ge 60 ] do count=$((count+1)) sleep 1 done I know [ -f $filename -o $count -ge 60 ] is a test command, "-f $filename" ...
2
votes
1answer
18 views

More shell scripts than one in one text file?

I am learning shell scripting for my introductory UNIX course at my university, and I`m curious if is it possible to have more than one shell script in one text file. What I mean by that is, for ...
3
votes
3answers
155 views

Having an issue searching for a string in a file

I have tried to use a 'case' loop but it doesn't work for a reason unknown to me. This is my script for the case loop. echo "Do you wish to search again? [y/n]" read INPUT_STRING2 case ...
0
votes
1answer
30 views

Uuencode displaying attachment content in email body

I am using uuencode with mailx to attach a zip file. In following code, the if block works perfectly and I get Deletions.zip as an attachment in the email. But, whenever the else block is executed I ...
6
votes
2answers
258 views

Compare two files and print matches

Is there anyway to get this through Unix shell scripting? I have a fileA with one column (1000 rows), and fileB with 26 columns(13000 rows). I need to search each value of fileA with fileB and return ...
-3
votes
0answers
27 views

How to extract strings from a given input file and store them in two different files in a column wise manner

Given below is the input file pattern: *********************************************************** Search URL: ...
2
votes
1answer
50 views

Opening a terminal other than xterm, running a command on it, and not closing the terminal after it succesfully finished

I have the following script in my arch linux box: #!/bin/bash xterm -e "sudo pacman -Syu;bash" This will fire up an xterm, and run the command sudo pacman -Syu on it. Because of the ;bash part, it ...
-6
votes
0answers
23 views

Script after downloading the file move them to other location [closed]

I need help with a script that does the following Firefox finishes downloading a file to default folder. Compare the downloaded file to a predefined list of files. If the filename exists in the ...
0
votes
0answers
31 views

How to list the services I am authorized to start or stop in Linux? [closed]

I can use the following command in Linux, to list all services: chkconfig --list It lists all services running on that machine. I do not have the privilege to start/stop some of the services. How ...
-1
votes
0answers
11 views

/etc/logrotate.conf “/var/log/btmp” want to replace digit script [closed]

I want to replace with script.. rotate 77 "/var/log/btmp" in /etc/logrotate.conf weekly rotate 99 create dateext include /etc/logrotate.d /var/log/wtmp { monthly create 0600 root utmp ...
-5
votes
0answers
34 views

Need help with a shell script [closed]

I have this script and it's not working and I don't know why. #! /bin/bash for dia in `more global_seismicity_feb27-apr19_2010.txt | awk '{print $2}' | sort -u` do #Count number of earthquakes in ...
0
votes
1answer
41 views

Got “syntax error near unexpected end of file” in bash script

I'm making an script that gives me a day like this jjj/yyyy when I give it a day like this dd/mm/yyyy and I need it to have an error when you don't write correctly but I'm starting and it's not ...
6
votes
2answers
152 views

how to mount a range of drives in bash?

I use something like this to unmount a range of drives: umount /dev/sd[c-k]2 Is there any way to use same thing with mount? something like this: mount /dev/sd[c-k]2 /[c2-k2]
2
votes
3answers
320 views

How do you fire a sequence of commands at the command tool?

I had a previous question (deleted it) and I still don't understand why it is so hard to understand what I'm trying to ask, but I'll try once again and more clearly. So I'm copying over several ...
3
votes
2answers
53 views

Compare 2 tab delimited files and output differences with column header

I would like to compare 2 similar files on a common column. The files will have identical headers. file1.txt mem_id Date Time Building aa bb cc dd ee ff ...
-3
votes
0answers
16 views

I am having trouble with a problem my buddy game me [migrated]

SCRIPTING PROBLEM: Command Output Parser Write a script/program to parse the output of the command 'cat test_file.txt' (see linked file) The program should: Create a new file for every server. The ...
2
votes
1answer
19 views

Work out the command line of a GUI operation?

I am trying to script one repetitive operation within an open-source software, FSLView to be specific. The operations are extremely straightforward in the GUI, I mean just several clicks. However, I ...
2
votes
1answer
23 views

create numbered files with defined content with bash

I want to create 69 files with a filename from 4006 through to 7075 and it each file needs to have some enumerated content, the following code prints on the shell what I would like to have inserted ...
2
votes
2answers
44 views

Sed find and replace with slashes

I am having trouble using sed find/replace with slashes in the find parameter. Sample contents of test.sh str=$(sed -n '/^user:/p' /tmp/shadowtest) # find "user:" line in /etc/shadowtest ...
1
vote
1answer
119 views

Pattern replacement

Please can anyone explain to me in brief the syntax of this command. Explanation in terms of how actually this command is written significance of each and every character used. I know the output of ...
3
votes
1answer
29 views

How to save the result of printf to a variable in GDB?

(gdb)printf "Hello %d", 7 Hello 7 (gdb)set $MyVar = printf "Hello %d", 7 // ??? How to save the result of printf "Hello %d", 7 to $MyVar?
0
votes
0answers
23 views

How to execute a GDB command from a string variable? [migrated]

Say the debugged process has a string variable as follows: char* cmd_str = "set confirm on"; How to execute the command from cmd_str in GDB? (gdb) $cmd = cmd_str (gdb) ???
3
votes
3answers
125 views

How to mask passwords in 'watch' command?

I am using watch to monitor the progress of a MySQL replication slave. The way I have it set up now, the password shows up in the header of the watch output. I am not exceedingly worried that someone ...
2
votes
1answer
37 views

Read target of symlink and increment target by one

I have a folder structure that looks like this /some/folder/1 /some/folder/2 ... and a symlink current that links to one of the folders. Is it possible and when how to read the target of the link, ...
2
votes
1answer
27 views

Script command without output

Is there something similar to script that records ONLY the commands and not any output from them to a file?
1
vote
0answers
33 views

Startup script with LSB headers not working correctly (dependency problem)?

I am creating a startup script for my Ubuntu 14.04.1 LTS server. The script need to be run after the Rabbit MQ server. The Rabbit MQ startup script says it provides "rabbitmq-server". So I put this ...
-3
votes
2answers
29 views

how to take the file names from folder

i want to write a program for the below logic: Take the names of files in a folder For each file: print file name move the file to another new folder (with the name in dd_mm_yy format)
1
vote
3answers
95 views

How to get a response from any URL?

I have been asked to write a shell script To check if a URL is UP/Working or not for my Project. I tried to find some hints over the internet, but whatever I got is about checking whether the URL ...
2
votes
3answers
132 views

Run a script on multiple shells?

I have two servers one AIX with default shell ksh, the other RHEL with default shell bash. I have a script that is mounted on both that will run similar commands but for either AIX or Linux. This ...
1
vote
1answer
58 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 ...
1
vote
4answers
62 views

Delete all but largest file in multiple directories

I have multiple subdirectories in /home/usr/ProjZ/programs/ that each contain multiple (or one) .js files. What I need to do is delete all but the largest .js file, if the subdirectory contains ...
3
votes
1answer
129 views

Preserve formatting when command output is sent to a variable? [duplicate]

I have a bash script. If I run this command to: grep for certain patterns, transform the output, sort the output dedupe the output then I get one grep find per line in terminal LC_ALL=C grep ...
3
votes
2answers
80 views

split a file, pass each piece as a param to a script, run each script in parallel

I have a words.txt with 10000 words (one to a line). I have 5,000 documents. I want to see which documents contain which of those words (with a regex pattern around the word). I have a script.sh that ...
0
votes
0answers
39 views

bash script loses readonly value after first time thru loop

I have a bash script which seems to lose the value of the readonly constant after the first time thru the for-in loop. For example: #!/bin/bash readonly DIR="./groups/" for output in "${array[@]}" do ...
1
vote
2answers
73 views

List all the html tags in a file

I want to know if there is a way to list all the html tags in a file. Lets say I have a file file.html <html> <head> <title>Test</title> </head> <body> This is a ...
2
votes
2answers
36 views

I seem to be “losing” this prompt. What is happening?

I ssh into an ubuntu 12.04 cloud server and start a web server like this (w/ bash): $ nohup python tserver.py & [2] 2122 $ nohup: ignoring input and appending output to `nohup.out' After I run ...
1
vote
2answers
207 views

How to iterate through multiple file extension without caring about case sensitivity?

I've seen various topics on how to iterate through multiple file extensions but in most case, the list is defined. example: for file in ${arg}/**/*.{txt,h,py} do .... done As can be seen, ...
5
votes
3answers
216 views

How to iterate through a list of files with spaces that is sorted (case insensitive)?

I am doing this in OSX which uses bash but obviously, not all bash conventions are used so hopefully your suggestion is available to me :) I have the following files fun bar1.txt Foo bar2.tXT ...
2
votes
1answer
65 views

Fetching Remote Windows System Information From Linux Server

I need a script/command that would fetch Windows System Information (Host Name,User Name, Domain, OS Info, Hardware Info, Memory Info, processor Info, etc) by running it on a Linux Server (RHEL 6.5 ...
6
votes
2answers
110 views

Passing arguments from a file to a bash script

I' ve got this situation: ./ ./myscript.sh ./arguments.txt ./test.sh Inside myscript.sh, i have to run the file test.sh, passing to it the arguments contained inside arguments.txt. myscript.sh is: ...
4
votes
3answers
290 views

awk with if statements

I am trying to print from a file using awk, but my output is empty. Here is my code so far accountNum=$1 while read -r LINE || [[ -n $LINE ]] ; do awk -F',' '{ if($1==accountNum) { print ...
2
votes
1answer
66 views

Renaming the files and move to other path

I need to rename the files given below and move to some other path 1234551abcde20140718023216001.txt.809047512.2014_07_07_13:47:44 000001abcde20140718023216001.txt.34568.001.2014_07_07_13:50:44 ...
5
votes
1answer
160 views

Converting .docx files to plain text and preserving line breaks to maintain line number references to source document: howto & implications?

I'm exporting MS Word content to plain text for use with text&file utilities. I have a constraint where the line numbering feature has been enabled in the MS software, and any reference to line ...
0
votes
2answers
159 views

Solution to integer expression expected [closed]

So I when I run this code on my mac there are no errors, and it provides me the perfect output. But when I run it on Ubuntu or CentOS i get the following error integer expression expected ...
3
votes
1answer
55 views

Copy image from clipboard to file

Is it possible to take an image from the clipboard and output it to a file (using X)? I can do this with text easily: $ xclip -selection c -o > file.text But when I try the above with an image ...
0
votes
1answer
44 views

Reusing user input in a script

I have the following script which works: #!/bin/bash xfreerdp /cert-ignore /f /v:farm.company.com /d:company.com /g:rds.company.com /u:$(zenity --entry --title="Username" --text="Username") ...
2
votes
2answers
129 views

Pass argument to script, then redirect script as input to bsub

I am currently working with the bsub job submission system from Platform LSF. I need to submit job scripts, but I am running into a problem with passing arguments to the job script. What I need is as ...
3
votes
1answer
71 views

Run command based on output of another command

OS: AIX 7100-04-1216 So basically I'm trying to write a for loop that sees which volumegroups I have on my system, which filesystems reside in those volume groups and what the size of each of those ...
0
votes
2answers
124 views

If UID=1000 continues, else exit

I am wondering how to implement the following in a bash script. if UID=1000, continue else exit confirm choice (y/n)