Questions tagged [scripting]

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

Script are supposed to be smaller program, easy to write and useful for specific and daily tasks.

Further reading

4464 questions
6
votes
5 answers

Remove Same Column Values

I have a very big file and I want to remove if the column value is 9. Sample: My file value like this: 1 5 8 3 5 9 5 7 6 9 2 5 7 4 2 9 7 6 3 1 5 9 7 4 1 9 5 7 9 1 I want to delete any columns where the value, on all rows, is 9 ( my column size is…
John
  • 161
5
votes
4 answers

Prefixing and appending blocks of text to a list of files

I'm trying to prefix and append blocks of text to a list of files. Here is where I am so far. The sticking point is the sed -i "1i \$prefix" "$file" && line. sed won't substitute the value of prefix in. I tried to follow various threads about this…
Faheem Mitha
  • 35,108
4
votes
1 answer

Script Command without Junk Character

I'm Using Unix script command to record everything which is output to the terminal and place it in a log file. but when I see recorded file, it also include Junk Character. So how to record terminal activity without Junk Character. Output Example…
Rahul Patil
  • 24,711
4
votes
2 answers

Problem with getting unique output in script

I have a file containing list of URLs (one entry in one line). After processing it to extract the host- (server-)names with the script below (which works correctly), the host names that appeared multiple times in the input were appearing multiple…
Mcgiwer
  • 61
4
votes
1 answer

Alternatives to XDialog

Are there any alternatives to XDialog? Ideally something that would support both X server and terminal interface.
Šimon Tóth
  • 8,238
4
votes
3 answers

What does `export COLUMNS` do?

What is the significance of importance of the command export COLUMNS ? What I know is that it's a global variable. I frequently see it in the beginning of *nix scripts.
chrisjlee
  • 8,523
4
votes
6 answers

Search for an user name in file and output the user's phone number

First I made a file called telephone containing: Jan;032569874 Annemie;014588529 Hans;015253694 Stefaan;011802367 And what I now need to do is make a script where the user inputs a name and the output should look like, The phone number…
sdff
  • 65
3
votes
13 answers

Is there a scripting language with C-like syntax?

I can neither code Bash nor Python (actually, I am only comfortable with C-like syntax), and, actually, am too busy and lazy to learn them now. But I would like to script some tasks. Is there a scripting language for GNU/Linux, having obvious and…
Ivan
  • 17,708
3
votes
2 answers

How to know, what SHELL is used when running a script?

How can I output that what shell is used to execute a script? Ex.: the $SHELL variable gives that what is the default shell for the given user. That is ok, but the given user can launch the script with other shell, ex.: "sh script.sh" or "csh…
3
votes
4 answers

How useful is Linux scripting?

I am trying to move to intermediate level by learning the shell commands. In online Linux forums it's often the consensus that to be an advanced Linux user one should know scripting. I myself have no experience with scripting the OS and don't know…
3
votes
2 answers

Is there a special device that causes read to block forever?

I’m looking for a variant of /dev/null that causes read to block forever, rather than returning EOF immediately. Does such a device exist? I could probably create a named pipe (via mkfifo) to achieve the desired effect, but I’d rather not have to…
benesch
  • 131
3
votes
3 answers

How to automatically run a script when I connect a bluetooth device?

I have a bluetooth headset and I need to execute a .sh file everytime I connect it to make it work. I don't want to troubleshoot this bug since I know there's already people looking into it. But I'm interested on a way to run that .sh script every…
Maccer
  • 243
3
votes
4 answers

Compare characters

I have two lines, which are saved in two variables. But it doesn't really matter, where they are saved. My question is, how do I compare each character from both lines? For examples Hello Hlleo result: true (H), false ... ,true (o)
Mafi
  • 129
3
votes
3 answers

Converting rows to row groups

Can somebody please help me with the below conversion shell script ? Source File File 1 : for example EXCHANGE_ID : 192, 410, EXCHANGE_DTTM : 2015-06-11+02:18:40+0000, 2015-06-11+02:12:28+0000, PART_NAME …
arsh
  • 81
3
votes
3 answers

Conditional statement, "unary operator expected"

I am having a problem with an example script that is given in the textbook 'Unix and System Administration Handbook'. The script is below... I am receiving an error that states logscript: line 8: [: 1: unary operator expected. # The log level is…
zzz2991
  • 153
1
2 3
9 10