Tagged Questions

Bash (the Bourne again shell) is a Unix shell. It was intended as a free replacement to the Bourne shell and includes many scripting features from ksh. Bash is intended to conform to the POSIX 1003.2 standard. Bash also includes more advanced interactive features such as command line editing with ...

learn more… | top users | synonyms

2
votes
1answer
16 views

How do I detect whether changes in nano were discarded or saved?

I am currently writing a small setup script for a Linux application that needs the user to edit a configuration file before the application is started. I've chosen to make the script simply open the ...
1
vote
1answer
29 views

How do I execute a remote shell script over SSH and be prompted for passwords by commands that require it in that script?

I want to do something like this ssh [email protected] ./remote_script.sh Contents of remote_script.sh #!/bin/bash hg pull This example is much simpler than what I am actually doing. I know ...
2
votes
2answers
39 views

How to add a line to a file which has only root write permission and to continue the script execution

I am trying to learn bash scripting. I am working on a practical problem and at one point I need to add a line to a file which requires root permission to write. The code looks like this: # some ...
0
votes
0answers
49 views

Where can I find a storage integrity (write/read) test using basic bash scripting?

I am in need of shell scripts and/or bash commands to verify data integrity of local harddrives, usb-drives, etc. I am looking for a solution like the famous www.heise.de/download/h2testw or ...
1
vote
2answers
59 views

How do I delete the first n lines of an ascii file using shell commands?

I have multiple files that contain ascii text information in the first 5-10 lines, followed by well-tabulated matrix information. In a shell script, I want to remove these first few lines of text so ...
2
votes
1answer
78 views

When is using ~+ useful?

As I understand it, ~+ means the same thing as "the current working directory". So echo ~+ should print the same as pwd. What is the purpose of this tilde expansion ~+ ?
0
votes
0answers
30 views

How can I compile getopt and getopts separately? [migrated]

I am looking at the source for bash, and I was able to create a getopts.c using the mkbuiltins executable. Now I am trying to create separate getopt and getopts binaries. How can I go about doing ...
0
votes
1answer
14 views

Fedora 7 server export in .bashrc not getting set

I'm trying to set the JAVA_HOME environment variable in my .bashrc but every time I log back in it gets unset again to its original value, below is my .bashrc file # .bashrc # User specific aliases ...
2
votes
1answer
56 views

Why doesnt ctrl+d work with this?

I wanted a simple way to process text in my clipboard without having to create a file. I tried using the following line: awk '{print $1}' <(cat) but I couldn't send cat the EOF character using ...
1
vote
1answer
41 views

How to enable tab completion of wildcards in bash?

How can I enable tab completion in bash for a statement such as vim db/migrate/*crea? Essentially I am looking for tab completion to match the regular expression and present the options. How would ...
3
votes
2answers
40 views

Insert multiline text into several files via commandline

I want to insert some code into multiple tex files foo*.tex in a directory, one line after \documentclass{.*}. Note that the files have different document classes so the .* is just a symbolic ...
5
votes
1answer
52 views

Get “date” to understand a timestamp phrase of a different language

My web-scraping scripts have long enjoyed using date -d to read in human-formatted time and date stamps like "March 11, 1999" and convert to any other format I need via the -s parameter. How might I ...
2
votes
2answers
41 views

Compile all tex files in a directory

If I do pdflatex *.tex in a directory, only one tex file is compiled. Which syntax should I use that all *.tex files in the directory are compiled?
4
votes
1answer
48 views

Order of redirections

I don't quite understand how the computer reads this command. cat file1 file2 1> file.txt 2>&1 If I understand, 2>&1 simply redirect Standard Error to Standard Output. By that ...
0
votes
0answers
50 views

Bash getopts and passing parameters

I am trying to use getopts and assign different outcomes when a flag is passed. What I am doing is passing a -f flag and what I want to happen is the outcome either puts the command on stdout ready ...

1 2 3 4 5 68
15 30 50 per page