How create two txt in nano linux?
I would to ask if it's possible to create two txt files in one nano.
This is what i tried
but when I opened the the file 'os', there was only the s1.txt file.
Nano is a text editor. In it you write a script. Your script is called
Your script writes Nothing to file
s1.txtthen tries three commands called
threewhich probably will just throw errors. It then writes nothing again to file
s2.txtand then tries three more commands that most likely will error
You exit nano, but you don't run your non-working script.
I suspect that s1.txt already existed in your directory (not file)
If you wish to write the test
threeto a file in your script then you can use
echo "one\ntwo\nthree" > s1.txt echo "four\nfive\nsix" > s2.txt
And then run the script.
See also questions close to this topic
user ID for file owner change testing (Linux)
I wish to test some code that will change file ownership. Normally the test file will be created with ownership of the user running the test. I need to verify that the program can change ownership to some (any) other user. I tried using the user 'nobody' which exists on Debian Linux (and derivatives) and that results in a permission violation. I tried using an arbitrary UID/GID of 10000/10000 and that seems to work. I'm not really comfortable using an arbitrary number because it seems to me that it might be possible that a user with this UID/GID might exist and cause the test to fail.
Is there a better choice for a user for this kind of testing
(The actual code under test will replace a file with a link and needs to match ownership of the link to that of the file it is replacing if file permissions allow.)
Wine failed to insall msxml3 with winetricks
My wine version is 2.22 on Fedora 25. I have also tested it on wine 3.0 RC-5 on Fedora 25 ,and it failed.
When I install msxml3 using winetricks it gave me errors like:
fixme:ntdll:NtLockFile I/O completion on lock not implemented yet fixme:setupapi:SetupQueryInfOriginalFileInformationW (0x9b1640, 0, (nil), 0x8abe98): semi-stub fixme:setupapi:SetupPromptReboot 0x145468, (nil), 1: stub
I think I have to install msxml3 because it is required when installing vcrun2008 and vcrun 2010 in wine.
By the way,it also failed when I was installing vcrun2008 and vcrun2010.
arch linux bluetooth auto-connect wiimote
Well this is driving me crazy and I can't seem to find anyone having a similar problem, or anything related.
I have a wimmote setup on arch linux, it is paired and I can connect manually by running the bluetoothctl connect xx:xx:xx command, however I cannot seem to get it to re-connect again after a timeout or a reboot.
Pressing the power button (or any key) does not re-establish the connection until I again issue the connect command.
The bluetooth service is enabled and the bluetooth controller is powered on.
Surely it is possible for the wiimote to connect just by pressing the power button at any time without needing to manually execute a command from the console each time ?
This is the device info, it is enabled and trusted, however as above, I cannot connect by using the wiimote power button ??
[bluetooth]# info B8:AE:6E:B9:64:A7 Device B8:AE:6E:B9:64:A7 Name: Nintendo RVL-CNT-01-TR Alias: Nintendo RVL-CNT-01-TR Class: 0x000508 Icon: input-gaming Paired: yes Trusted: yes Blocked: no Connected: no LegacyPairing: no UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb) UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb) Modalias: usb:v057Ep0330d0001
Run Multiple Tasks in the same Command Line using ShellExecuteEx in Delphi
I am trying to run multiple tasks in the same command line using ShellExecuteEx. I have no issue running it in cmd.exe, as shown below:
C:\Program Files (x86)\AppFolder>App.exe MyTask1&&App.exe MyTask2 Running task: Task1 Table: Task1 100 Complete Running task: Task2 Table: Task2 100 Complete C:\Program Files (x86)\AppFolder>
Now, here's my ShellExecuteEx version in Delphi running one task without any issue:
procedure TfrmGTX.btnQBSyncClick(Sender: TObject); var FileName, Parameters, Folder, Directory: string; sei: TShellExecuteInfo; Error: DWORD; OK: boolean; begin Folder := 'C:\Program Files (x86)\AppFolder\'; FileName := Folder + 'App.exe'; Parameters := 'MyTask1'; ZeroMemory(@sei, SizeOf(sei)); sei.cbSize := SizeOf(sei); sei.lpFile := PChar(FileName); sei.lpParameters := PChar(Parameters); sei.lpDirectory := PChar(Folder); sei.nShow := SW_SHOWNORMAL; OK := ShellExecuteEx(@sei); if not OK then begin Error := GetLastError; ShowMessage('Error: ' + IntToStr(Error)); end; end;
What I am trying to achieve is to run 2 tasks one after the other using ShellExecuteEx. No pre-condition/relationship between them. Its the same function but serves data to different tables in my database.
My questions are:
- Is it possible to run these 2 tasks in 1 ShellExecuteEx command in the parameter? If so, what's the best way to do it inside the parameter?
- Or should I create a for loop to run these 2 tasks one after the other?
- Or any suggestion?
I prefer the first one as it is cleaner and within the functionalities of ShellExecuteEx.
I have seen some works saying that I should separately run them or create some script.
Function CreateProcess and notepad
I have problem with function CreateProcess() from windows.h. My task is to "Create process that is using notepad.exe to create txt file that contains some string". I know how to open notepad using CreateProcess() however if i pass file name to it notepad says that file is not existing and ask me if i want to create it. So i have to confirm it by myself but it should be done by itself within the process. And then i have no clue how to insert data inside txt file using notepad while not doing it by myself and then save file. If you have idea how to do it please tell me.
How to edit file inside a docker container into amazon web services server?
I installed docker with my required files but now I need to edit and save into docker I tried with nano but unfortunately unable to install and also I tried with vim but it does not work.
So i searched for it finally I founded it (How to edit file after I shell to a docker container?) in this question, the 2nd answer is an easy way to edit but I don't know how to copy files from the live server(aws) into local.
Please help me how to do this. thanks in advance...!
indentation Error python 2.7
Hello I am having an indentation error on python 2.7
My program looks like this: Imports:
import sys, os import subprocess from threading import Thread from re import split
def GetProcesses(Clean=True): # if Clean == True: # # x = subprocess.Popen(["sudo", "ps", "aux"], stdout=subprocess.PIPE, shell=True) (out, err) = x.communicate() print(out) print(out.split("\n")) print("--------------") Processes = out.split("\n") print(Processes) print("------") print(Processes) print("----------") Header = Processes Process_list = Processes.remove(Processes) return((Header, Process_list)) # else: # # if Clean == True: #added problem so future SE users can see it x = subprocess.Popen(["ps", "aux"], stdout=subprocess.PIPE, shell=True) (out, err) = x.communicate() return(out)
I am not understanding the error, I have tried de-denting everyline 1 space, indenting back to the originals, and adding 1 space but it always says that it either expects an indent, or unexpected indent. P.S I am using only spaces.
File "MemoryHandling.py", line 31 x = subprocess.Popen(["ps", "aux"], stdout=subprocess.PIPE, shell=True) ^ IndentationError: expected an indented block
I have check several online questions/sources (mainly SE) for this error (below) both during and before asking this question, i found that they were case specific, downvoted / not answered, or were not usefull:
-- Python Indentation Error # i am using spaces
-- Python 2.7 Indentation error # i have manually checked indentation multiple times, and tried using the tab key
-- Unexpected indentation error, but indentation looks correct # once again not using tabs and spaces
-- Code Indent Error, code is indented? # not answered (bug?)
-- Python Indentation Error when there is no indent error # once more not using tabs and spaces