The requirement is to create a shell script that can create a FileName.java file where FileName would be the parameter passed to the script while running the script. Example: On executing the above command, a file Sample.java should get created with content: If sources for learning bash scripting is added in …
Failed to fetch https://download.docker.com/linux/ubuntu/dists/serena/stable/binary-amd64/Packages 404 Not Found in Linux Mint
When I do sudo apt-get update I get the following error: I know there is a similar question here but still I am not able to solve the problem. I am running on Distributor ID: LinuxMint Description: Linux Mint 18.1 Serena Release: 18.1 and the file /etc/apt/sources.list which seems to be important contains the…
Writing a wave generator with SDL
I’ve coded a simple sequencer in C with SDL 1.2 and SDL_mixer(to play .wav file). It works well and I want to add some audio synthesis to this program. I’ve look up the and I found this sinewave code using SDL2(https://github.com/lundstroem/synth-samples-sdl2/blob/master/src/synth_samples_sdl2_2.c…
How to list files recursively with complete path, size, last accessed date and last modified date?
It can be using find, ls or stat Expected output: Answer You can try this : Size is in K-bytes
POSIX open() hangs on SMB share
I have a problem where I mount a Windows SMB share under linux with mount.cifs and write to files from my C++ program. This works fine, but as soon as network problems arise (i.e. Windows server disconnect), opening the file with POSIX open() will hang indefinitely. The same happens for the POSIX close() call…
variable to switch the pre-requisites for a target in a Makefile
I wish to use ‘MY_TYPE’ to switch the prerequisites for the target ‘top’. based on MY_TYPE Can I select the pre-requisites required For example, for MY_TYPE=FOO , I wish to have $(BUILD) $(TARGETS) $(X_LOCALS) as pre-requisites for top MY_TYPE=BAR , I wish to have $(BUILD) $(TARGETS) $…
why “mpv $(ls video *)” is not the same as “mpv video *”? (pls help noobie to work with shell)
So, the problem is – I have a list of files and I want to send them into a program, so it could handle this list in the same process. What I mean is, for example I have a bunch video files, that I want to play with mpv, but I need to pass them into a certain order which
Sed is truncating first character if it is starting with “v” while appending in file
I am stuck in one of my production code where I am trying to append some content at the start of file and if the content which I want to append is starting with “v” , its getting truncated. Steps to reproduce: Output: Desired Output: Answer Your use of the backslash is wrong. Check this: Your esca…
Shell script to replace all spaces in only the column headers to underscore in a csv file
I am trying to just replace the spaces in the column headers only with underscores(_). this is my sample data Input Output My sample code is something like this, sorry its very rough! Answer Unless your example is too simplistic, you just have to change all spaces to underscores in line 1
How do I expose custom files similar to /procfs on Linux?
I have a writer process which outputs its status at regular intervals as a readable chunck of wchar_t. I would need to ensure the following properties: When there’s and update, the readers shouldn’t read partial/corrupted data The file should be volatile in memory so that when the writer quits, th…